Package: cyrtranslit
What is CyrTranslit?A Python package for bi-directional transliteration of Cyrillic script to Latin script and vice versa.By default, transliterates for the Serbian language. A language flag can be set in order to transliterate to and from Bulgarian, Montenegrin, Macedonian, Mongolian, Russian, Serbian, Tajik, and Ukrainian.What is transliteration?Transliteration is the conversion of a text from one script to another. For instance, a Latin alphabet transliteration of the Serbian phrase"Мој ховеркрафт је пун јегуља"is"Moj hoverkraft je pun jegulja".CitationA citation would be much appreciated if you use CyrTranslit in a research publication:Georges Labrèche. (2023). CyrTranslit (v1.1.1). Zenodo. https://doi.org/10.5281/zenodo.7734906BibTex entry:@software{georges_labreche_2023_7734906,author={Georges Labrèche},title={CyrTranslit},month=mar,year=2023,note={{A Python package for bi-directionaltransliteration of Cyrillic script to Latin scriptand vice versa. Supports transliteration forBulgarian, Montenegrin, Macedonian, Mongolian,Russian, Serbian, Tajik, and Ukrainian.}},publisher={Zenodo},version={v1.1.1},doi={10.5281/zenodo.7734906},url={https://doi.org/10.5281/zenodo.7734906}}Supporting researchCyrTranslit is actively used as a reliable tool to advance research! Here's an incomplete list of publications for research projects that have relied on CyrTranslit:Ljajić, Adela & Prodanović, Nikola & Medvecki, Darija & Bašaragin, Bojana & Mitrović, Jelena. (2022). "Topic Modeling Technique on Covid19 Tweets in Serbian," in 12th International Conference on Information Society and Technology (ICIST), Kopaonik, Serbia.Mussylmanbay, Meiirgali. (2022). "Addresses Standardization and Geocoding using Natural Language Processing," Nazarbayev University, Kazakhstan.Jokic, Danka & Stanković, Ranka & Krstev, Cvetana & Šandrih Todorović, Branislava. (2021). "A Twitter Corpus and Lexicon for Abusive Speech Detection in Serbian," in 3rd Conference on Language, Data and Knowledge (LDK 2021). 10.4230/OASIcs.LDK.2021.13.Lakew, Surafel Melaku (2020). "Thesis Multilingual Neural Machine Translation for Low Resource Languages," University of Trento, Italy.Filo, Denis. (2020). "Neuronový strojový překlad pro jazykové páry s malým množstvím trénovacích dat: Low-Resource Neural Machine Translation," Brno University of Technology, Brno, Czechia.Batanović, Vuk & Nikolic, Bosko. (2019). "Using Language Technologies to Automate the UNDP Rapid Integrated Assessment Mechanism in Serbian," in International Conference on Language Technologies for All: Enabling Linguistic Diversity and Multilingualism Worldwide (LT4All), Paris, France.Brown, J. M. M. & Schmidt, Andreas & Wierzba, Marta (Eds.). (2019). "Of trees and birds: A Festschrift for Gisbert Fanselow," Universitätsverlag Potsdam, Potsdam.Lakew, Surafel Melaku & Erofeeva, Aliia & Federico, Marcello. (2018). "Neural Machine Translation into Language Varieties," in 3rd Conference on Machine Translation: Research Papers, Brussels, Belgium.Ljajić, Adela & Marovac, Ulfeta. (2018). "Improving sentiment analysis for twitter data by handling negation rules in the Serbian language," Computer Science and Information Systems. 16. 13-13. 10.2298/CSIS180122013L.Жабран, И., Кикоть, А., Гафияк, А., Бородина, Е., & Алёшин, С. (2017). "Developing Q-Orca site backend using various Python programming language libraries," Modern Engineering and Innovative Technologies, 3(07-03), 48–53.How do I install this?CyrTranslit ishosted in the Python Package Index (PyPI)so it can be installed using pip:python -m pip install cyrtranslit         # latest version
python -m pip install cyrtranslit==1.1.1  # specific version
python -m pip install cyrtranslit>=1.1.1  # minimum versionWhat languages are supported?CyrTranslit currently supports bi-directional transliteration of Bulgarian, Montenegrin, Macedonian, Mongolian, Russian, Serbian, Tajik, and Ukrainian:>>>importcyrtranslit>>>cyrtranslit.supported()['bg','me','mk','mn','ru','sr','tj','ua']How do I use this?CyrTranslit can be used both programatically and via command line interface.ProgrammaticallyBulgarian>>>importcyrtranslit>>>cyrtranslit.to_latin("Съединението прави силата!","bg")"Săedinenieto pravi silata!">>>cyrtranslit.to_cyrillic("Săedinenieto pravi silata!","bg")"Съединението прави силата!"Montenegrin>>>importcyrtranslit>>>cyrtranslit.to_latin("Република","me")"Republika">>>cyrtranslit.to_cyrillic("Republika","me")"Република"Macedonian>>>importcyrtranslit>>>cyrtranslit.to_latin("Моето летачко возило е полно со јагули","mk")"Moeto letačko vozilo e polno so jaguli">>>cyrtranslit.to_cyrillic("Moeto letačko vozilo e polno so jaguli","mk")"Моето летачко возило е полно со јагули"Mongolian>>>importcyrtranslit>>>cyrtranslit.to_latin("Амрагаа Сүнжидмаагаа гэсээр ирлээ дээ хө-хө-хө","mn")"Amragaa Sünjidmaagaa geseer irlee dee khö-khö-khö">>>cyrtranslit.to_cyrillic("Amragaa Sünjidmaagaa geseer irlee dee khö-khö-khö","mn")"Амрагаа Сүнжидмаагаа гэсээр ирлээ дээ хө-хө-хө"Russian>>>importcyrtranslit>>>cyrtranslit.to_latin("Моё судно на воздушной подушке полно угрей","ru")"Moyo sudno na vozdushnoj podushke polno ugrej">>>cyrtranslit.to_cyrillic("Moyo sudno na vozdushnoj podushke polno ugrej","ru")"Моё судно на воздушной подушке полно угрей"Serbian>>>importcyrtranslit>>>cyrtranslit.to_latin("Мој ховеркрафт је пун јегуља")"Moj hoverkraft je pun jegulja">>>cyrtranslit.to_cyrillic("Moj hoverkraft je pun jegulja")"Мој ховеркрафт је пун јегуља"Tajik>>>importcyrtranslit>>>cyrtranslit.to_latin("Ман мактуб навишта истодам","tj")"Man maktub navišta istodam">>>cyrtranslit.to_cyrillic("Man maktub navišta istodam","tj")"Ман мактуб навишта истодам"Ukrainian>>>importcyrtranslit>>>cyrtranslit.to_latin("Під лежачий камінь вода не тече","ua")"Pid ležačyj kamin' voda ne teče">>>cyrtranslit.to_cyrillic("Pid ležačyj kamin' voda ne teče","ua")"Під лежачий камінь вода не тече"Command Line InterfaceSample command line call to transliterate a Russian text file:$cyrtranslit-lRU-itests/ru.txt-otests/output.txtUse the -c argument to accomplish the reverse, that is to input latin characters and output cyrillic.Use the -h argument for help.You can also omit the input and output files and use standard input/output$echo'Мој ховеркрафт је пун јегуља'|cyrtranslit-lsr
Mojhoverkraftjepunjegulja
$echo'Moj hoverkraft je pun jegulja'|cyrtranslit-lsr
МојховеркрафтјепунјегуљаYou can test the "script" by running it directly on the Python command line interface, e.g.:>>>importsys>>>importcyrtranslit.cyrtranslit>>>sys.argv.extend(['-l','RU'])>>>sys.argv.extend(['-i','tests/ru.txt'])>>>sys.argv.extend(['-o','tests/output.txt'])>>>cyrtranslit.cyrtranslit.main()>>>exit()How can I contribute?You can include support for other Cyrillic script alphabets. Follow these steps in order to do so:Create a new transliteration dictionary in themapping.pyfile and reference to it in theTRANSLIT_DICTdictionary.Watch out for cases where two consecutive Latin alphabet letters are meant to transliterate into a single Cyrillic script letter. These cases need to be explicitly checked forinside theto_cyrillic()function in__init__.py.Add test cases inside oftests.py.Add test CLI input files in thetestsdirectory.Update the documentation in theREADME.md.List yourself as one of the contributors.Before tagging a release version and deploying toPyPI:Update theversionanddownload_urlproperties insetup.py.Reserve a Zenodo DOIfor the release and update this readme's Zenodo badge andcitation instructions.A big thank you to everyone who contributed:Bulgarian 🇧🇬:@Syndamiaand@Sparkycz.Russian 🇷🇺:@ratijasand@rominf.Tajik 🇹🇯:@diejani.Ukrainian 🇺🇦:@AnonymousVoice1.Mongolian 🇲🇳:@Serbipunk.Command Line Interface (CLI):@ZJaume.