jdlorimer / chinese-support-redux

Anki add-on providing support for Chinese study
https://ankiweb.net/shared/info/1128979221
GNU General Public License v3.0
101 stars 50 forks source link

Jyutping auto-fill not working #110

Open CageR2 opened 4 years ago

CageR2 commented 4 years ago

Hey, the Add-on works perfectly fine for mandarin pinyin, but cantonese jyutping will always raise an error message when trying to add new cards. Error-message: """ Debug info: Anki 2.1.15 (442df9d6) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3 Platform: Windows 10 Flags: frz=True ao=True sv=1

Caught exception: File "aqt\webview.py", line 27, in cmd File "aqt\webview.py", line 87, in _onCmd File "aqt\webview.py", line 368, in _onBridgeCmd File "aqt\editor.py", line 273, in onBridgeCmd File "anki\hooks.py", line 39, in runFilter File "C:\Users\Toucanet\AppData\Roaming\Anki2\addons21\1128979221\edit.py", line 74, in onFocusLost if update_fields(note, field, allFields): File "C:\Users\Toucanet\AppData\Roaming\Anki2\addons21\1128979221\behavior.py", line 266, in update_fields fill_color(hanzi, copy) File "C:\Users\Toucanet\AppData\Roaming\Anki2\addons21\1128979221\behavior.py", line 156, in fill_color field = get_first(config['fields'][field_group], note) <class 'KeyError'>: 'jyutping' """

Would be great if this could get fixed, I can't add any new Cantonese Vocabs as of now.. Thank you ^~^

ahj10 commented 3 years ago

Bumping this error, still ongoing a year after (Jan 2021).

jdlorimer commented 3 years ago

Thanks for the bump. Until the weekend, I'll just be triaging the outstanding issues, but once that's done development will be back in full swing.

ahj10 commented 3 years ago

Could you add this database for the Cantonese dictionary? The one currently in is not really for Cantonese. It's just characters in Mandarin translated to jyutping. That is ok, but mostly used for written and very formal Cantonese settings. The big ones are the ones people use in spoken canto. Here is a good database for Canto: https://github.com/gwinterstein/Cifu

Thank you!

jdlorimer commented 3 years ago

Just had a lazy look at the code (https://github.com/luoliyan/chinese-support-redux/blob/master/chinese/data/db/update)

Isn't CC-Canto already imported into the database?

jdlorimer commented 3 years ago

I'll have a look at the one you linked, though. Don't think I'm familiar with it.

ahj10 commented 3 years ago

The problem with CC-canto is that it doesn't rank words. For example (and I don't know how much Canto you know so pardon the ignorance). The word "clothes" is yifu in mandarin but saam in cantonese. Now, people will write yifu in Cantonese instead but they use saam in common speech. I would say I would prefer the database I sent you to learn Cantonese (spoken). The very few minority of people want to learn highly academic Cantonese for which CC canto would be useful. For the beginner and for a dictionary, the more coloquial database would be better.

jdlorimer commented 3 years ago

But yīfu and saam1 are written with different characters, so the database lookup would pull the correct colloquial Cantonese, unless I'm missing something?

jdlorimer commented 3 years ago

@ahj10 If you can give a specific example of (a) your input and (b) the expected output, I can write a unit test to make sure it gets fixed.