vonpetersenn / Pleco-to-Anki

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

Error thrown when pinyin starts with a capital letter #8

Open ethanxrosen opened 4 days ago

ethanxrosen commented 4 days ago

happens whether or not I have the "reformat pinyin" option active on importing. any flash cards below the capital pinyin entry in the export.txt won't be imported after the error is thrown.

in my case the specific word this happened for was 阿弥陀佛 E5mi2tuo2fo2 Buddhism and I assume it will also happen for other proper nouns I went into the export.txt and changed it to lowercase "e5mi2tuo2fo2" after which things started working correctly again

error below:

Anki 24.04 (429bc9e1) (ao) Python 3.9.18 Qt 6.6.2 PyQt 6.6.1 Platform: macOS-14.6.1-arm64-arm-64bit

Traceback (most recent call last): File "/Users/ethan/Library/Application Support/Anki2/addons21/427686509/init.py", line 60, in excecuted_function bookmark = Bookmark(slice, configs) File "/Users/ethan/Library/Application Support/Anki2/addons21/427686509/pleco/Bookmark.py", line 14, in init self.pinyin_pretty = convert_from_numerical_pinyin(self.pinyin_ugly) File "/Users/ethan/Library/Application Support/Anki2/addons21/427686509/tones/numerical_pinyin_converter.py", line 47, in convert_from_numerical_pinyin finished_char = convert_indiv_character(indiv_character) File "/Users/ethan/Library/Application Support/Anki2/addons21/427686509/tones/numerical_pinyin_converter.py", line 108, 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]) AwesomeTTS - Add speech to your flashcards ['1436550454', 2024-09-14T14:04, 'None', ''] Chinese Support 3 ['1752008591', 2024-02-25T17:37, 'None', mod] Learning Step and Review Interval Retention ['1949865265', 2024-01-07T01:48, 'None', ''] Pleco to Anki ['427686509', 2024-05-03T22:31, 'None', ''] Straight Reward ['957961234', 2023-11-01T22:11, 'None', '']

===IDs of active AnkiWeb add-ons=== 1436550454 1752008591 1949865265 427686509 957961234

===Add-ons (inactive)=== (add-on provided name [Add-on folder, installed at, version, is config changed])

vonpetersenn commented 4 days ago

Interesting one! Captital letters in Pinyin are non-standard, but if Pleco uses them this Addon should support them too. I will try to update the Addon soon. Probably by automatically changing all pinyin-input to lowercase before further processing.