Skip to main content
Translating a passage so that what is found in the translation can still be pointed at in the original.

translation.aligned

Aligned translation: the map between a source span and its translation is exact because the cuts are ours.

Aligned

AlignedConfig

The wording of the two prompts.

AlignedTranslator

ask(prompt) -> reply text: any model, local or remote. Construct with AlignedTranslator(ask: Callable[[str], str], config: AlignedConfig \| None = None).

Segment

numbers_match

The same numbers, as a multiset: a dropped or changed digit is the error that matters most in a rule.

parse_numbered

{number: text} for the lines of reply that read [k] text with 1 <= k <= n.

segments

(the faithful passage, one Segment per non-empty line).

translation.checks

Checks on a translation, as a function check(source, translation) -> [problems]; an empty list means it passed.

basic

Empty answer, or numbers that differ from the source’s.

make_check

basic, plus the term-list gate of ladygraph.llm.translate when a Glossary is given, plus any checks of your own.

translation.escalation

Escalation: a cheap step first; stronger steps only for what the check rejects.

Attempt

Outcome

Step

escalate

translation.hints

Term hints: the glossary entries that occur in a text, as a note appended to a translation prompt.

term_hint

“\n\nGlossary (…): term = rendering; …” for the terms of glossary found in text, longest first, or "" when none is.

translation.verify

Verification: a second model reads (source, translation) pairs and reports what is wrong, in a fixed vocabulary of error types.

LlmVerifier

Construct with LlmVerifier(llm: LlmClient, *, source_language: str = 'the source language', target_language: str = 'English', domain: str = 'text', batch: int = 8).

Verdict

VerdictError

Verifier

Construct with Verifier(*args, **kwargs).

verifier_check

An escalation check (check(source, translation) -> problems) backed by a verifier: a verdict in fail_on becomes the problems.