qirimtatar-tts / crh_transliterator /transliterator.py
Yurii Paniv
Proper translit PoC
ed1082e
raw
history blame
258 Bytes
from .cyr_to_lat import mappings
import re
def transliterate(text: str):
text = text.lower() # always treat lowercase
text = " " + text + " "
for mapping in mappings:
text = re.sub(mapping[0], mapping[1], text)
return text[1:-1]