tetrak_translit.transliterate

tetrak_translit.transliterate(text, scheme='ala_lc', *, script=None, to='latin')[source]

Transliterate text between a script and scheme.

Parameters:
  • text (str) – The text. For to="latin" the script’s letters in it are rendered and everything else is passed through; otherwise the whole string is read as Latin in scheme.

  • scheme (str | Scheme) – A scheme key ("ala_lc", "iso_9985", "bgn_pcgn", "hubschmann_meillet", "western" for Armenian; "ala_lc", "iso_9984", "national" for Georgian), optionally qualified with the script ("ka/ala_lc"), or a Scheme.

  • script (str | Script | None) – Which script, when the text and the key do not settle it: a key ("hy", "ka") or name ("Armenian").

  • to (str) – "latin" (the default); "script" to read Latin back; or a script key or name, which reads back into that script.

Returns:

The transliterated string.

Raises:
  • UnknownSchemeError – scheme names no table, or tables in several scripts with nothing to choose between them.

  • UnknownScriptError – script or to names no script.

  • NotReversibleError – reading back through a lossy scheme.

Return type:

str