Fix translit.

This commit is contained in:
Jim Miller 2018-08-01 11:57:05 -05:00
parent 4335900aa5
commit eb8a5b2c68

View file

@ -2,6 +2,10 @@
# Code taken from http://python.su/forum/viewtopic.php?pid=66946 # Code taken from http://python.su/forum/viewtopic.php?pid=66946
from __future__ import absolute_import from __future__ import absolute_import
# py2 vs py3 transition
from .six import text_type as unicode
from .six import ensure_text
import unicodedata import unicodedata
def is_syllable(letter): def is_syllable(letter):
syllables = ("A", "E", "I", "O", "U", "a", "e", "i", "o", "u") syllables = ("A", "E", "I", "O", "U", "a", "e", "i", "o", "u")
@ -39,7 +43,7 @@ def romanize(letter):
return func(filter(is_consonant, unid)) return func(filter(is_consonant, unid))
def translit(text): def translit(text):
output = "" output = ""
for letter in text: for letter in ensure_text(text):
output += romanize(letter) output += romanize(letter)
return output return output
#def main(): #def main():