_roomaji_youon = {
u'ャ': 'ya', u'ュ': 'yu', u'ョ': 'yo',
- u'ゃ': 'ya', u'ゅ': 'yu', u'ょ': 'yo',
+ #u'ゃ': 'ya', u'ゅ': 'yu', u'ょ': 'yo',
}
# XXX If romanize() ever handles hiragana, it will need to make sure that the
# Youon
elif char in _roomaji_youon:
- if last_kana[-1] != 'i' or last_kana == 'i':
+ if not last_kana or last_kana[-1] != 'i' or last_kana == 'i':
raise ValueError("Youon must follow an -i sound.")
# Drop the -i and append the ya/yu/yo sound
new_sound = _roomaji_youon[char]
- if last_kana in ['shi', 'ji']:
+ if last_kana in ['chi', 'shi', 'ji']:
# Strip the y-
new_char = last_kana[:-1] + new_sound[1:]
else:
last_kana = new_char
# Sokuon
- elif char in (u'っ', u'ッ'):
+ #elif char in (u'っ', u'ッ'):
+ elif char in (u'ッ',):
# Remember it and double the consonant next time around
last_kana = 'sokuon'
if last_kana == 'sokuon':
raise ValueError("Sokuon cannot be the last character.")
- return ''.join(characters)
+ return unicode(''.join(characters))