Thanks to visit codestin.com
Credit goes to github.com

Skip to content

IndexError on certain character #1

@alvations

Description

@alvations

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>く

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions