mortii / anki-morphs

A MorphMan fork rebuilt from the ground up with a focus on simplicity, performance, and a codebase with minimal technical debt.
https://mortii.github.io/anki-morphs/
Mozilla Public License 2.0
55 stars 8 forks source link

IndexError: list index out of range #79

Closed mortii closed 9 months ago

mortii commented 9 months ago

I got this error message when I recalc, is it because my frequency list is too long? Three langs 50K.

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 23.10.1 (fac9e0ee) Python 3.9.15 Qt 6.6.0 PyQt 6.6.0 Platform: Windows-10-10.0.23590 Flags: frz=True ao=True sv=3 Add-ons, last update check: 2023-11-30 11:03:10 Add-ons possibly involved: ⁨ankimorphs-alpha⁩

Caught exception: Traceback (most recent call last): File "aqt.taskman", line 138, in _on_closures_pending File "aqt.taskman", line 82, in File "aqt.taskman", line 102, in wrapped_done File "aqt.operations", line 252, in wrapped_done File "C:\Users\Administrator\AppData\Roaming\Anki2\addons21\472573498\recalc.py", line 761, in _on_failure raise error File "concurrent.futures.thread", line 58, in run File "aqt.operations", line 242, in wrapped_op File "C:\Users\Administrator\AppData\Roaming\Anki2\addons21\472573498\recalc.py", line 76, in _recalc_background_op _update_cards_and_notes(am_config) File "C:\Users\Administrator\AppData\Roaming\Anki2\addons21\472573498\recalc.py", line 282, in _update_cards_and_notes morph_priority: dict[str, int] = _get_morph_priority(am_db, config_filter) File "C:\Users\Administrator\AppData\Roaming\Anki2\addons21\472573498\recalc.py", line 442, in _get_morph_priority morph_priority = _get_morph_frequency_file_priority( File "C:\Users\Administrator\AppData\Roaming\Anki2\addons21\472573498\recalc.py", line 488, in _get_morph_frequency_file_priority key = row[0] + row[1] IndexError: list index out of range

Originally posted by @HQYang1979 in https://github.com/mortii/anki-morphs/issues/78#issuecomment-1833999671

mortii commented 9 months ago

@HQYang1979 can you upload the frequency.csv files? Files longer than 50K should still work without errors. This error might come from empty lines or something, not sure.

mortii commented 9 months ago

This could possibly be related to #69, maybe there are some morphs that cause back-end problems.

HQYang1979 commented 9 months ago

see the frequency files en_50k.csv es_50k.csv jp_50k.csv

mortii commented 9 months ago

Ah, your csv files have the wrong format. You need two columns, first column needs to contain the base-morph-form, and the second one with inflected-morph-form.

image

Here is an example: jp_frequency.csv

You can read about it here: frequency.csv guide

When you use the Frequency File Generator it automatically creates the csv files in the correct format.

HQYang1979 commented 9 months ago

OK, I thought I could just use a word list.

mortii commented 9 months ago

Only having one morph version like the morphman frequency.txt does can lead to many false positives. I think our version is better.

Let me know if you have other problems with this feature.

github-actions[bot] commented 6 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.