Error while adding readings involving mixed kana/kanji
ahlec opened this issue · 0 comments
ahlec commented
When adding readings to a single word that has the same kana as part of a kanji reading and as a standalone character, the plugin raises an error.
Example sentence: 「テスト勉強の息抜きとか どうしてんの」
The crash happens when trying to add readings to 息抜き【いきぬき】. When it is handling the "いき" portion, the mixed-kana/kanji algorithm does a string search and "skips ahead" to the standalone き at the end of the word. This means that it then runs out of characters in the kanji
to associate the remainder of the reading with (we're at the end of 息抜き but still need to associate the 「ぬき」 remaining in the reading).
Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue to the add-on author.
Debug info:
Anki 2.1.54 (b6a7760c) Python 3.9.7 Qt 6.3.1 PyQt 6.3.1
Platform: Mac 12.4
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2022-10-16 14:03:04
Add-ons possibly involved: **JapaneseFurigana**
Caught exception:
Traceback (most recent call last):
File "aqt.webview", line 42, in cmd
File "aqt.webview", line 149, in _onCmd
File "aqt.webview", line 624, in _onBridgeCmd
File "aqt.editor", line 467, in onBridgeCmd
File "/Users/alec/Library/Application Support/Anki2/addons21/678316993/__init__.py", line 48, in <lambda>
editor._links["generateFurigana"] = lambda ed=editor: doIt(ed, generateFurigana)
File "/Users/alec/Library/Application Support/Anki2/addons21/678316993/__init__.py", line 56, in doIt
Selection(editor, lambda s: action(editor, s))
File "/Users/alec/Library/Application Support/Anki2/addons21/678316993/selection.py", line 43, in __init__
self.setHtml(None, callback)
File "/Users/alec/Library/Application Support/Anki2/addons21/678316993/selection.py", line 64, in setHtml
self.setHtml(self.window.note.fields[self.window.currentField], callback, True)
File "/Users/alec/Library/Application Support/Anki2/addons21/678316993/selection.py", line 49, in setHtml
callback(self)
File "/Users/alec/Library/Application Support/Anki2/addons21/678316993/__init__.py", line 56, in <lambda>
Selection(editor, lambda s: action(editor, s))
File "/Users/alec/Library/Application Support/Anki2/addons21/678316993/__init__.py", line 61, in generateFurigana
html = mecab.reading(html, config.getIgnoreNumbers(), config.getUseRubyTags())
File "/Users/alec/Library/Application Support/Anki2/addons21/678316993/reading.py", line 201, in reading
if areKanaEqual(kanji[indexKanji], reading[indexReading]):
IndexError: string index out of range