tetrak_ocr.outputs

Output formats for a finished transcript.

One transcript can be written several ways at once — Markdown for a human, plain text for a downstream tool, a searchable PDF for a catalogue — so the pipeline asks for a set of formats rather than a single one.

Every writer exposes the same callable:

write(source, transcript, destination, **options) -> None

source is the file that was transcribed, which the text formats ignore and the PDF writer needs (it embeds the scan). options carries format-specific settings; a writer must tolerate options meant for a different format, because the caller passes one dict to all of them.

Adding a format means adding one entry to _FORMATS and nothing else: the CLI takes its choices, its help text and its validation from this table, the same way backends are resolved through registry.py.

Functions

canonical(name)

Resolve a format name or alias, raising for anything unrecognised.

describe()

Format list for --help, one per line.

extension(name)

The file extension a format writes, including the leading dot.

parse(values)

Turn CLI --format values into an ordered list of canonical names.

write(name, source, transcript, ...)

Write transcript in format name, returning the path written.