MikimotoH / furigana

Generate furigana from Japanese
Other
93 stars 26 forks source link

IndexError on certain character #1

Open alvations opened 6 years ago

alvations commented 6 years ago

There're characters that throws an IndexError, e.g. in 聞く:

>>> from furigana.furigana import print_html

>>> print_html(u'聞')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ltan/.local/lib/python3.5/site-packages/furigana/furigana.py", line 109, in print_html
    for pair in split_furigana(text):
  File "/home/ltan/.local/lib/python3.5/site-packages/furigana/furigana.py", line 97, in split_furigana
    kana = node.feature.split(",")[7] # 読み仮名を代入
IndexError: list index out of range

>>> print_html(u'私のお願い聞ってくださる')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ltan/.local/lib/python3.5/site-packages/furigana/furigana.py", line 109, in print_html
    for pair in split_furigana(text):
  File "/home/ltan/.local/lib/python3.5/site-packages/furigana/furigana.py", line 97, in split_furigana
    kana = node.feature.split(",")[7] # 読み仮名を代入
IndexError: list index out of range

>>> print_html(u'聞く')
<ruby><rb>聞</rb><rt>き</rt></ruby>く
sydridgmLee commented 6 years ago

have you fix it?