mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2025-12-06 08:52:55 +01:00
Fix translit.
This commit is contained in:
parent
4335900aa5
commit
eb8a5b2c68
1 changed files with 5 additions and 1 deletions
|
|
@ -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():
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue