vonpetersenn / Pleco-to-Anki

An AddOn for the flashcard App to import bookmark files from the chinese dictionary app Pleco.
The Unlicense
9 stars 3 forks source link

Problem Importing. #13

Closed PhilipYang89 closed 1 hour ago

PhilipYang89 commented 1 week ago

Anki 24.06.3 (d678e393) (ao) Python 3.9.18 Qt 6.6.2 PyQt 6.6.1 Platform: Windows-10-10.0.22621 Traceback (most recent call last): File "D:\Users\X\AppData\Roaming\Anki2\addons21\427686509\__init__.py", line 59, in excecuted_function bookmark = Bookmark(slice, configs) File "D:\Users\X\AppData\Roaming\Anki2\addons21\427686509\pleco\Bookmark.py", line 14, in __init__ self.pinyin_pretty = convert_from_numerical_pinyin(self.pinyin_ugly) File "D:\Users\X\AppData\Roaming\Anki2\addons21\427686509\tones\numerical_pinyin_converter.py", line 50, in convert_from_numerical_pinyin finished_char = convert_indiv_character(indiv_character) File "D:\Users\X\AppData\Roaming\Anki2\addons21\427686509\tones\numerical_pinyin_converter.py", line 111, in convert_indiv_character raise ValueError("Invalid numerical pinyin. Input does not contain a vowel.") ValueError: Invalid numerical pinyin. Input does not contain a vowel. ===Add-ons (active)=== (add-on provided name [Add-on folder, installed at, version, is config changed]) Pleco to Anki ['427686509', 2024-10-02T09:15, 'None', ''] ===IDs of active AnkiWeb add-ons=== 427686509 ===Add-ons (inactive)=== (add-on provided name [Add-on folder, installed at, version, is config changed])

I'm using the newest Anki 24.06.3 version, basically what ends up happening is that instead of the roughly 10.000 cards I have, only half will be imported with many duplicates also present. I tried exporting in "Both", "Simplified", "Traditional" and I get the same result. On a side note, I don't know if Categories aren't supposed to be supported by this Add-On but I do have HSK categories divided inside Pleco that I would love to export directly into Anki but I noticed they are all organised inside the same "pleco" Deck. I'd appreciate any help regarding this. Thanks.

vonpetersenn commented 1 week ago

From the error message, it looks like there is some word, that has a non-standard or unexpected pinyin/pronunciation. Are you using mandarin pronunciation? Can you check which word is failing ( probably the first one that is not being imported )?

Regarding the duplications. Could it be, that you tried importing the Pleco bookmarks several times? Or do you actually have duplicate bookmarks in Pleco?

Categories are not supported. But you could export the categories as several bookmark files and then import them one by one, moving each set of notes into a separate folder in Anki.

PhilipYang89 commented 6 days ago

Both Simplified and Traditional seem to be written fine, but there are references that seem to break? I basically use Pleco's recommended new HSK library (https://iphone.pleco.com/flash.html). I believe Pleco automatically generates the examples after importing those, so maybe it has something to do with that? Regarding duplicates I double checked and they seem to be properly ordered, so it's a bit strange to me.

Regarding the categories, individually exporting each category seems to be the best solution indeed. My goal using this Add-On was to kind of preserve both Simplified and Traditional words next to each other for comparison if possible.

vonpetersenn commented 4 days ago

I tried importing the example that you provided and it works without any problem. The problem probably does not have anything to do with your export/import settings but rather with one or several notes that you export that have some unexpected formatting which the AddOn cannot handle.

vonpetersenn commented 4 days ago

My goal using this Add-On was to kind of preserve both Simplified and Traditional words next to each other for comparison if possible.

Given the exampel that you provided, the Hanzi field will read: 草[草], so you do have both the traditional and simplified next to each other. I am not sure if this is the behaviour you where looking for?

PhilipYang89 commented 3 hours ago

Yes, that's I wanted! The issue had more to do with half of the imports not actually being imported from Pleco which I guess is due to the definitions that have some kind of error coding with UTF-8... As a last resort I could always import from the HSK textfile but without definitions or examples along it. Still, thanks for the help :)