tetrak_translit.engine

The transliteration engine: pure functions over a Scheme.

Script to Latin walks each word letter by letter, longest unit first (so a digraph is taken whole), rendering each through the scheme’s table and carrying the source’s case across: a capital letter capitalises its rendering, a word in capitals renders in capitals. Text outside the scheme’s script passes through untouched, so a mixed-script line – an Armenian title with a Latin author – comes out with only the Armenian changed.

Latin to script is offered only for the schemes whose tables are one-to-one. The rest are lossy by construction – ALA-LC’s ts is ծ or տ``+``ս – and guessing would be worse than refusing. For matching across schemes, which needs no guessing, there is tetrak_translit.fold().

This module knows nothing about which scripts exist; it is given a scheme and reads the script from it. That is what lets a script package’s fold use it without a circular import.

Module Attributes

APOSTROPHES

Every apostrophe-like mark a reader might type for an aspiration or ejective sign.

Functions

read(text, scheme)

Read Latin written in scheme back into its script.

render(text, scheme)

Render the scheme's script in text to Latin, leaving the rest alone.

Exceptions

NotReversibleError

Raised when asked to reverse a scheme whose table is lossy.