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. Punctuation is the scheme’s to say: marks its standard maps are rendered where they stand or moved to the end of the sentence, and the rest are left alone. 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 zh 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
|
Every apostrophe-like mark a reader might type for an aspiration or ejective sign. |
Functions
|
Read Latin written in scheme back into its script. |
|
Render the scheme's script in text to Latin, leaving the rest alone. |
Exceptions
|
Raised when asked to reverse a scheme whose table is lossy. |