Package: graphtransliterator
A graph-based transliteration tool that lets you convert the symbols of one
language or script to those of another using rules that you define.Free software: MIT licenseDocumentation:https://graphtransliterator.readthedocs.ioRepository:https://github.com/seanpue/graphtransliteratorTransliteration… What? Why?Moving text or data from one script or encoding to another is a common problem:Many languages are written in multiple scripts, and many people can only read one of
them. Moving between them can be a complex but necessary task in order to make
texts accessible.The identification of names and locations, as well as machine translation,
benefit from transliteration.Library systems often require metadata be in particular forms of romanization in
addition to the original script.Linguists need to move between different methods of phonetic transcription.Documents in legacy fonts must now be converted to contemporary Unicode ones.Complex-script languages are frequently approached in natural language processing and
in digital humanities research through transliteration, as it provides disambiguating
information about pronunciation, morphological boundaries, and unwritten elements not
present in the original script.Graph Transliterator abstracts transliteration, offering an “easy reading” method for
developing transliterators that does not require writing a complex program. It also
contains bundled transliterators that are rigorously tested. These can be expanded to
handle many transliteration tasks.Contributions are very welcome!FeaturesProvides a transliteration tool that can be configured to convert the tokens
of an input string into an output string using:user-defined types of inputtokensandtoken classestransliteration rulesbased on:a sequence of input tokensspecific input tokens that precede or follow the token sequenceclasses of input tokens preceding or following specified tokens“on match” rulesfor output to be inserted between transliteration
rules involving particular token classesdefined rules forwhitespace, including its optional consolidationCan be setup using:an“easy reading”YAMLformat that lets you
quickly craft settings for the transliteration toolaJSONdump of a transliterator (quicker!)“direct”settings, perhaps passed programmatically, using a dictionaryAutomatically orders rulesby the number of tokens in a
transliteration ruleChecks for ambiguityin transliteration rulesCan providedetailsabout each transliteration rule matchAllowsoptional matching of all possible rulesin a particular locationPermitspruning of ruleswith certain productionsValidates, as well asserializesto anddeserializesfrom JSON
and Python data types, using accessiblemarshmallowschemasProvidesfull support for Unicode, including Unicodecharacter namesin the “easy reading” YAML formatConstructs and uses adirected treeand performs abest-first searchto find the most specific transliteration rule in a given contextIncludesbundled transliteratorsthatyoucan add to
hat check for full test coverage of the nodes and edges of the internal graph and any
“on match” rulesIncludes a command-line interface to perform transliteration and other tasksSample Code and GraphfromgraphtransliteratorimportGraphTransliteratorGraphTransliterator.from_yaml("""
    tokens:
      h: [consonant]
      i: [vowel]
      " ": [whitespace]
    rules:
      h:\N{LATIN SMALL LETTER TURNED I}i:\N{LATIN SMALL LETTER TURNED H}<whitespace> i:\N{LATIN CAPITAL LETTER TURNED H}(<whitespace> h) i:\N{LATIN SMALL LETTER TURNED H}!
    onmatch_rules:
      - <whitespace> + <consonant>: ¡
    whitespace:
      default: " "
      consolidate: true
      token_class: whitespace
    metadata:
      title: "Upside Down Greeting Transliterator"
      version: "1.0.0"
""").transliterate("hi")'¡ᴉɥ!'Sample directed tree created by Graph Transliterator. Therulenodes are in double
circles, andtokennodes  are single circles. The numbers are the cost of the
particular edge, and less costly edges are searched first. Previous token classes
and previous tokens that must be present are found as constraints on the edges
incident to the terminal leafrulenodes.Get It Now$pipinstall-UgraphtransliteratorCitationTo cite Graph Transliterator, please use:Pue, A. Sean (2019). Graph Transliterator: A graph-based transliteration tool.
Journal of Open Source Software, 4(44), 1717,https://doi.org/10.21105/joss.01717