jdlorimer / chinese-support-redux Goto Github PK
View Code? Open in Web Editor NEWAnki add-on providing support for Chinese study
Home Page: https://ankiweb.net/shared/info/1128979221
License: GNU General Public License v3.0
Anki add-on providing support for Chinese study
Home Page: https://ankiweb.net/shared/info/1128979221
License: GNU General Public License v3.0
I'd love to have character decompositions available as a memory aid for learning Hanzi. Specifically, the cjkvi decomposition list could be integrated into Chinese Support, and then fields named "Decomposition" could be filled in with the decompositions listed therein. For bonus points, map these Unicode codepoints onto images of the components (maybe from Wikipedia?), since a user may not have the fonts to display some of the codepoints for more obscure glyphs, and then insert these images instead, keeping the original Unicode text as alt text.
Alternatively, I could write scripts to add this functionality to my own cards - the Unicode characters are trivial to encode, while the images will take just a bit more work. But others may appreciate having this out of the box.
When I use the current version (0.9.1) of the plugin to write new notes the field 彩色 doesn't get filled. If I edit an existing note that had this field populated, the content of the field even gets cleared.
I'd expect the field to hold the colored version of the characters I entered.
Describe the bug
When I go through a library of notes and tab fill for the Pinyin, Meaning etc., the Meaning field will be emptied if I don't select a different field before proceeding to the next note to convert.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The "Meaning" field should remain populated when switching notes.
Specs (please complete the following information):
I was filling in some new cards and received the following error. Not sure what card it fails on:
Specs (please complete the following information):
Additional context
Anki 2.1.7 (a6c34fd7) Python 3.6.7 Qt 5.12.0 PyQt 5.11.3
Platform: Mac 10.14.2
Flags: frz=True ao=True sv=1
Caught exception:
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/fill.py", line 385, in bulk_fill_hanzi
note.flush()
File "/Users/rmi1/Library/Application Support/Anki2/addons21/877182321/enhancedMain.py", line 694, in noteFlush
oldNoteFluh(note,mod=mod)
File "anki/notes.py", line 51, in flush
File "anki/notes.py", line 69, in joinedFields
File "anki/utils.py", line 265, in joinFields
<class 'TypeError'>: sequence item 6: expected str instance, NoneType found
Hi luoliyan,
there's still another dependency error for me which results in failing to load the addon correctly.
It's line 8 in tts.py:
import urllib3
The same type of error as in #12:
ModuleNotFoundError: No module named 'urllib3'
As a user I still prefer using a library of recorded Chinese sounds instead of machine generated sounds. The advantage of this file format over the computer generated sounds its that the recorded sound is clear and full of nuances. In my opinion this is really important in order to learn a language as Chinese.
This library I'm mentioning is a legacy of a previous Anki plugin Pinyin Toolkit I installed years ago and consists on about 1.630 sounds in MP3 format named with the pinyin system (sound and tone number).
So for the word 例如 I need to manually fill the field 'sound' with the following data: [sound:li4.mp3][sound:ru2.mp3]
Some examples:
举手 corresponds to [sound:ju3.mp3] [sound:shou3.mp3]
** needs to be filled with [sound:.zhong1.mp3] [sound:guo2.mp3]
It would be great if this task could be done automatically. It would be a huge time-saving feature.
Also the option to automatically fill the field on previous cards would be really helpful.
If further descriptions of the task is needed I would be glad to help.
Thank you in advance for your help and time dedicated to this plugin, personally I think it's one of the most useful ones you can use with Anki and has an invaluable resource for thousands of students around the world.
Describe the bug
I have noticed some problems with zhuyin and then ruby when creating new cards.
The zhuyin is right but the color of the first character is always that of the second. For exemple, ㄐㄧㄔㄤˇ appears all in green.
The second character is often missing, but the whole zhuyin has the colour of the second character.
For instance, for 機場 in the ruby field I get 機 and above ㄐㄧㄔㄤˇ in green.
However, if I add manually a space between characters in the zhuyin field both the zhuyin color and the ruby field will become correct. The pinyin field and the colour field will remain wrong.
I guess the problem has to do with that space?
Specs (please complete the following information):
Original report: ttempe/chinese-support-addon#62
⺌, ⺍, and 龵 (and most likely other Kangxi radicals) result in TypeError when entered into the Hanzi field.
Unlike previous version, 㣽 and 㚢 seem not to cause a problem.
Currently, the add-on simply reuses the Mandarin tone colours, which is incorrect because:
Cantonese needs at least 6 distinct tone colours (ideally 7, because high falling tone is not extinct yet).
Is your feature request related to a problem? Please describe.
I have a deck with a lot of notes, for which I have a simplified and a traditional field each. The relevant fields are named "Hanzi" and "Traditional". This deck started out with Anki 1.x and the Chinese support available in there, from ttempe, and I am using the "Chinese (Advanced)" model for my notes.
When I was adding or editing a node in the old Anki (ie, it can also be an old note which I created long ago), I start out filling the simplified Chinese into the "Hanzi" field. In Anki 1.x and Anki 2.0.x, I was able to then press the Tab key while the cursor was in the Hanzi field, and if I was online, the software would fill most of the other fields as needed. Eg. it would automatically fill the Traditional field, but also Meaning, Ruby, Sound etc.
Oh. I just see that it is probably the same as #53.
Describe the solution you'd like
I would like to see this module to have the same behaviour regarding the auto-filling of fields.
Describe alternatives you've considered
None.
Additional context
From my POV, it looks like this module autofills no field at all, but I've changed the subject of this ticket to highlight those fields which are most important to me.
Hi, I cannot download the addon. When entering the code in Anki Desktop I get the error: "Download failed: Error downloading: 404". I tried with other addons and it's working, so it should be a specific problem with this addon.
Also, the addon does not appear on the Ankiweb addon browser (but the page exists, of course, I found it on Google).
Describe the bug
Hi, I tried to update the addon but got an error message. After I updated it using debug mode, I can add new cards but I get an error message every time I try to make changes to an aready existing card.
To Reproduce
Error message while updating:
Anki 2.1.5 Python 3.6.1 Qt 5.9.2 PyQt 5.9
Platform: Windows 10
Flags: frz=True ao=True sv=1
Caught exception:
File "aqt\addons.py", line 380, in onDelete
File "aqt\addons.py", line 140, in deleteAddon
File "site-packages\send2trash\plat_win.py", line 58, in send2trash
<class 'OSError'>: Couldn't perform operation. Error code: 124
I managed to update it by opening Anki in debug mode. Now, when I try to make changes to an already existing card, I get this error:
Anki 2.1.5 Python 3.6.1 Qt 5.9.2 PyQt 5.9
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 80, in _onCmd
File "aqt\webview.py", line 333, in _onBridgeCmd
File "aqt\editor.py", line 268, in onBridgeCmd
File "anki\hooks.py", line 34, in runFilter
File "C:\Users\ASUS\AppData\Roaming\Anki2\addons21\1128979221\edit.py", line 74, in onFocusLost
if updateFields(note, field, allFields):
File "C:\Users\ASUS\AppData\Roaming\Anki2\addons21\1128979221\behavior.py", line 438, in updateFields
update_all_Transcription_fields(hanzi, fieldsCopy)
File "C:\Users\ASUS\AppData\Roaming\Anki2\addons21\1128979221\behavior.py", line 205, in update_all_Transcription_fields
update_Pinyin_fields(hanzi, d)
File "C:\Users\ASUS\AppData\Roaming\Anki2\addons21\1128979221\behavior.py", line 143, in update_Pinyin_fields
format_Pinyin_fields(d)
File "C:\Users\ASUS\AppData\Roaming\Anki2\addons21\1128979221\behavior.py", line 130, in format_Pinyin_fields
True
<class 'TypeError'>: accentuate() takes 1 positional argument but 2 were given
Specs (please complete the following information):
Thanks for your help!
Describe the bug
Pinyin does not fill in after hitting tab key
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Pinyin field should populate
Specs (please complete the following information):
Additional context
Not sure if this is my configuration or a bug but it worked before I upgraded
While using both this and the Japanese Support addon together, Japanese won't auto add readings unless the Chinese Support option is on. And it adds comment to the reading field, which effects {{kana:Reading}} output. Also attempts to fill Meaning field from Chinese dictionary. This could be fixed by only operating on note types containing the word "Chinese" in its name, as the Japanese Support only operates on note types containing the word "Japanese."
Synopsis
Characters with rare or infrequent alternates will use these for the pinyin and transcriptions.
Steps to reproduce
Put 草 in the field "Hanzi"
Press TAB
Observed behavior
The pinyin is filled with cao4
The meaning lists all of the definitions
Expected behavior
The pinyin is cao3.
If you check the dictionary, it lists cao3 as the more common pronounciation:
https://www.mdbg.net/chinese/dictionary?page=worddict&wdrst=0&wdqb=%E8%8D%89
I noticed the unihan dictionary has a field kFrequency mentioned in the comments. Is it as simple as changing the query to order results by this field?
Describe the bug
Error occurs when editing an existing card or adding a new card using Chinese Support Redux add-on.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Fields are populated as expected
Screenshots
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 on the add-ons section of our support site.
Debug info:
Anki 2.1.5 Python 3.6.1 Qt 5.9.2 PyQt 5.9
Platform: Mac 10.14.1
Flags: frz=True ao=True sv=1
Caught exception:
File "aqt/webview.py", line 27, in cmd
File "aqt/webview.py", line 80, in _onCmd
File "aqt/webview.py", line 333, in _onBridgeCmd
File "aqt/editor.py", line 268, in onBridgeCmd
File "anki/hooks.py", line 34, in runFilter
File "/Users/m/Library/Application Support/Anki2/addons21/1128979221/edit.py", line 74, in onFocusLost
if updateFields(note, field, allFields):
File "/Users/m/Library/Application Support/Anki2/addons21/1128979221/behavior.py", line 469, in updateFields
update_all_Sound_fields(hanzi, fieldsCopy)
File "/Users/m/Library/Application Support/Anki2/addons21/1128979221/behavior.py", line 350, in update_all_Sound_fields
updated1, errors1 = update_Sound_fields(hanzi, d)
File "/Users/m/Library/Application Support/Anki2/addons21/1128979221/behavior.py", line 315, in update_Sound_fields
s = sound(hanzi)
File "/Users/m/Library/Application Support/Anki2/addons21/1128979221/sound.py", line 54, in sound
return '[sound:%s]' % download_sound(hanzi, options[source])
File "/Users/m/Library/Application Support/Anki2/addons21/1128979221/tts.py", line 35, in download_sound
tts.save(path)
File "/Users/m/Library/Application Support/Anki2/addons21/1128979221/lib/gtts/tts.py", line 247, in save
self.write_to_fp(f)
File "/Users/m/Library/Application Support/Anki2/addons21/1128979221/lib/gtts/tts.py", line 187, in write_to_fp
part_tk = self.token.calculate_token(part)
File "/Users/m/Library/Application Support/Anki2/addons21/1128979221/lib/gtts_token/gtts_token.py", line 28, in calculate_token
seed = self._get_token_key()
File "/Users/m/Library/Application Support/Anki2/addons21/1128979221/lib/gtts_token/gtts_token.py", line 57, in _get_token_key
tkk_expr = re.search(".*?(TKK=.*?;)W.*?", line).group(1)
<class 'AttributeError'>: 'NoneType' object has no attribute 'group'
**Specs (please complete the following information):**
- OS: [e.g. Windows, iOS, Ubuntu]
- Anki Version [e.g. v2.0.52, v2.1.5]
- Chinese Support Version [e.g. v0.5.3-beta]
Additional context
Add any other context about the problem here.
What I do
What happens
What I would expect
Plugin version: 0.9.1
Anki version: 2.1.4
Describe the bug
Hi, again it is impossible to update the add-on, just like last time.
To Reproduce
When I try to update, I get this error:
Anki 2.1.7 (a6c34fd7) Python 3.6.7 Qt 5.12.0 PyQt 5.11.3
Platform: Windows 10
Flags: frz=True ao=True sv=1
Caught exception:
File "aqt\addons.py", line 394, in onCheckForUpdates
File "aqt\addons.py", line 156, in downloadIds
File "aqt\addons.py", line 117, in install
File "aqt\addons.py", line 140, in deleteAddon
File "lib\site-packages\send2trash\plat_win.py", line 86, in send2trash
<class 'OSError'>: [WinError 124] None: 'C:\Users\ASUS\AppData\Roaming\Anki2\addons21\112897~1'
Anki crashes whenever Chinese Support Redux attempts to fill in the card for "睘".
Specs (please complete the following information):
Additional context
This character seems to have some fields missing in CEDICT, if MDBG is anything to go by.
Describe the bug
If the Hanzi is a sentence with English characters (for example if it contains an English name), the pinyin and color fields are bad (especially the color)
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The reading should say "Brian de" (but not a big deal), and the color should say "Brian的" with appropriate tone colors (probably neutral tone for Brian).
Specs (please complete the following information):
Describe the bug
When trying to fill Pinyin, it throws an error and stops. I assume the error is that you have two functions with the same name fill_pinyin
, one in behaviour.py
, one in fill.py
. They are shadowed in fill.py
.
To Reproduce
Steps to reproduce the behavior:
Chinese -> Fill Notes -> Fill Transcription and Color
Expected behavior
It fills Pinyin fields.
Error Message
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 on the add-ons section of our support site.
Debug info:
Anki 2.1.5 Python 3.6.1 Qt 5.9.2 PyQt 5.9
Platform: Windows 7
Flags: frz=True ao=True sv=1
Caught exception:
File "E:\AnkiData\addons21\1128979221\fill.py", line 185, in fill_pinyin
results += fill_pinyin(hanzi, note_dict)
<class 'TypeError'>: fill_pinyin() takes 0 positional arguments but 2 were given
Specs (please complete the following information):
Is your feature request related to a problem? Please describe.
I just started out learning Mandarin last week and immediately found Anki and your really great chinese-support addon. Thanks for maintaining! I also bought the Hanping Pro dictionary app on Android which I think has some really nice sound database. However, as far as I can see you can only combine Anki+Hanping using sth. like
<a href='android-app://com.embermitre.hanping.app.pro#Intent;action=com.hanpingchinese.cmn.intent.action.PLAY;S.p={{text:Pinyin}};S.s={{text:Simplified}};S.t={{text:Traditional}};S.LANG=cmn;S._SOURCE=anki;end'>
in cards, where S.p
seems to be the important part for it to work. Unfortunately, it only takes pinyin in numbered form.
Describe the solution you'd like
Could you please add to config.json
another field, e.g. NumPinyin
, that will be filled with the corresponding numbered pinyin instead of the one with converted tone markings? That would also be helpful for cards with {{type:NumPinyin}}
when learning with "simple" keyboards.
I would do it myself and provide a pull request, but because of lack of documentation it's somehow hard to go through your code.
Describe alternatives you've considered
Writing a JavaScript converter in each card's code.
Original request: ttempe/chinese-support-addon#68
Describe the bug
After the last update, the problem with the space in the zhuyin/pinyin transcription persists (affecting tone colour and the ruby field). I have noticed that there is a new problem with the zhuyin transcription: some tone marks disappear, although the pinyin field is correct.
Examples:
神韻 zhuyin: ㄕㄣㄩㄣˋ but pinying: shényùn (right tones)
巨大無比 zhuyin: ㄐㄩㄉㄚˋ ㄨㄅㄧˇ but pinyin: jùdà wúbǐ
不錯 ㄅㄨㄘㄨㄛˋ but bùcuò
試圖 ㄕㄊㄨˊ but shìtú
不好意思 ㄅㄨㄏㄠㄧㄙˋ but bùhǎoyìsi
百戰百勝 ㄅㄞㄓㄢㄅㄞㄕㄥˋ but bǎizhànbǎishèng
So it seems to be a problem with zhuyin. I just tried with a few words and expressions, for most of them zhuyin has wrong tones.
Specs (please complete the following information):
Is your feature request related to a problem? Please describe.
I am studying traditional characters but I sometimes accidentally copy and paste or import sentences with simplified characters in them. I would like to be able to convert these cards to traditional, but even searching for them is not so easy (my quick fix currently: I added a "Traditional" field that I let the plugin fill, and then I sort the cards by the Traditional field: all cards that have a non-empty Traditional field contain simplified characters).
Describe the solution you'd like
Two possible fixes:
Fill incomplete notes -> Fill simplified/traditional
Debug info:
Anki 2.1.0beta24 Python 3.6.3 Qt 5.10.0 PyQt 5.9.2
Platform: Linux
Flags: frz=False ao=True
Caught exception:
File "/home/nbrr/.local/share/Anki2/addons21/839350950/fill_missing.py", line 267, in fill_simp_trad
if (has_field(Simplified_fields, note_dict) or has_field(Traditional_fields, note_dict)) and has_field(Hanzi_fields, note_dict):
<class 'NameError'>: name 'Simplified_fields' is not defined
Simplified_fields and similar used to be defined in edit_behavior.py in the older version of the addon that is still on my disc, it is no longer present anywhere in the new version's files.
Attempted to copy the definitions from the old to the new edit_behavior.py file, got this error
Caught exception:
File "/home/nbrr/.local/share/Anki2/addons21/839350950/fill_missing.py", line 290, in fill_simp_trad
note.flush()
File "/usr/share/anki/anki/notes.py", line 51, in flush
fields = self.joinedFields()
File "/usr/share/anki/anki/notes.py", line 69, in joinedFields
return joinFields(self.fields)
File "/usr/share/anki/anki/utils.py", line 256, in joinFields
return "\x1f".join(list)
<class 'TypeError'>: sequence item 7: expected str instance, NoneType found
I noticed a big performance degrade after updating to version 0.10.0 of the plugin.
What I do
What happens
What I would expect
Cursor switches to the 繁體字 field without a noticable delay.
Specs:
Additional context
Drop-down menu "Fill Notes" > "Fill Translation" doesn't populate Mean Word/Classifier fields. I tested it on a deck with definitions already filled in. If I manually press TAB in the "Hanzi" field on such cards that I've previously filled in using that menu, the mean word is filled in.
Specs (please complete the following information):
I have seen the commit 6640223 where multiple possible field names in notes have been removed. I'm affected myself, as the plugin will not be able to fill all my fields (without renaming them) as soon as I install the commit.
I'm wondering whether there is an important reason to remove possible field names from the plugin. Even if you imagine better names, I think it wouldn't hurt supporting the old ones as well. Removing support for field names will break cards of some of the existing users of the plugin. I think this should only be done if there are good reasons for doing so. Most users probably won't be able to easily find the reason for that, let alone find out how to fix it. It also makes migration from other Anki chinese plugins (e.g. when upgrading from Anki 2.0 to 2.1) a lot harder, when there is no common intersection of field names.
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 on the add-ons section of our support site.
Debug info:
Anki 2.1.6-test Python 3.6.7 Qt 5.12.0 PyQt 5.11.3
Platform: Mac 10.14.1
Flags: frz=True ao=True sv=1
--- Logging error ---
Traceback (most recent call last):
File "logging/init.py", line 996, in emit
UnicodeEncodeError: 'ascii' codec can't encode character '\uff1f' in position 145: ordinal not in range(128)
Call stack:
File "runankimac", line 12, in
File "aqt/init.py", line 262, in run
File "aqt/init.py", line 347, in _run
File "aqt/webview.py", line 27, in cmd
File "aqt/webview.py", line 85, in _onCmd
File "aqt/webview.py", line 346, in _onBridgeCmd
File "aqt/editor.py", line 268, in onBridgeCmd
File "anki/hooks.py", line 34, in runFilter
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit.py", line 61, in onFocusLost
if updateFields(note, field, allFields):
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit_behavior.py", line 469, in updateFields
update_all_Sound_fields(fieldsCopy[currentField], fieldsCopy)
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit_behavior.py", line 350, in update_all_Sound_fields
updated1, errors1 = update_Sound_fields(hanzi, dico)
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit_behavior.py", line 315, in update_Sound_fields
s = sound(hanzi)
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit_functions.py", line 410, in sound
return '[sound:%s]' % tts.download_sound(text, options[source])
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/tts.py", line 34, in download_sound
tts = gTTS(text, lang=lang)
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/lib/gTTS/gtts/tts.py", line 108, in init
log.debug("%s: %s", k, v)
File "logging/init.py", line 1296, in debug
File "logging/init.py", line 1444, in _log
File "logging/init.py", line 1454, in handle
File "logging/init.py", line 1516, in callHandlers
File "logging/init.py", line 865, in handle
File "logging/init.py", line 1072, in emit
File "logging/init.py", line 1000, in emit
Unable to print the message and arguments - possible formatting error.
Use the traceback above to help find the error.
--- Logging error ---
Traceback (most recent call last):
File "logging/init.py", line 996, in emit
UnicodeEncodeError: 'ascii' codec can't encode characters in position 66-68: ordinal not in range(128)
Call stack:
File "runankimac", line 12, in
File "aqt/init.py", line 262, in run
File "aqt/init.py", line 347, in _run
File "aqt/webview.py", line 27, in cmd
File "aqt/webview.py", line 85, in _onCmd
File "aqt/webview.py", line 346, in _onBridgeCmd
File "aqt/editor.py", line 268, in onBridgeCmd
File "anki/hooks.py", line 34, in runFilter
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit.py", line 61, in onFocusLost
if updateFields(note, field, allFields):
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit_behavior.py", line 469, in updateFields
update_all_Sound_fields(fieldsCopy[currentField], fieldsCopy)
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit_behavior.py", line 350, in update_all_Sound_fields
updated1, errors1 = update_Sound_fields(hanzi, dico)
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit_behavior.py", line 315, in update_Sound_fields
s = sound(hanzi)
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit_functions.py", line 410, in sound
return '[sound:%s]' % tts.download_sound(text, options[source])
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/tts.py", line 34, in download_sound
tts = gTTS(text, lang=lang)
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/lib/gTTS/gtts/tts.py", line 108, in init
log.debug("%s: %s", k, v)
File "logging/init.py", line 1296, in debug
File "logging/init.py", line 1444, in _log
File "logging/init.py", line 1454, in handle
File "logging/init.py", line 1516, in callHandlers
File "logging/init.py", line 865, in handle
File "logging/init.py", line 1072, in emit
File "logging/init.py", line 1000, in emit
Unable to print the message and arguments - possible formatting error.
Use the traceback above to help find the error.
--- Logging error ---
Traceback (most recent call last):
File "logging/init.py", line 996, in emit
UnicodeEncodeError: 'ascii' codec can't encode characters in position 96-98: ordinal not in range(128)
Call stack:
File "runankimac", line 12, in
File "aqt/init.py", line 262, in run
File "aqt/init.py", line 347, in _run
File "aqt/webview.py", line 27, in cmd
File "aqt/webview.py", line 85, in _onCmd
File "aqt/webview.py", line 346, in _onBridgeCmd
File "aqt/editor.py", line 268, in onBridgeCmd
File "anki/hooks.py", line 34, in runFilter
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit.py", line 61, in onFocusLost
if updateFields(note, field, allFields):
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit_behavior.py", line 469, in updateFields
update_all_Sound_fields(fieldsCopy[currentField], fieldsCopy)
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit_behavior.py", line 350, in update_all_Sound_fields
updated1, errors1 = update_Sound_fields(hanzi, dico)
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit_behavior.py", line 315, in update_Sound_fields
s = sound(hanzi)
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit_functions.py", line 410, in sound
return '[sound:%s]' % tts.download_sound(text, options[source])
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/tts.py", line 35, in download_sound
tts.save(path)
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/lib/gTTS/gtts/tts.py", line 247, in save
self.write_to_fp(f)
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/lib/gTTS/gtts/tts.py", line 204, in write_to_fp
log.debug("payload-%i: %s", idx, payload)
File "logging/init.py", line 1296, in debug
File "logging/init.py", line 1444, in _log
File "logging/init.py", line 1454, in handle
File "logging/init.py", line 1516, in callHandlers
File "logging/init.py", line 865, in handle
File "logging/init.py", line 1072, in emit
File "logging/init.py", line 1000, in emit
Unable to print the message and arguments - possible formatting error.
Use the traceback above to help find the error.
--- Logging error ---
Traceback (most recent call last):
File "logging/init.py", line 996, in emit
UnicodeEncodeError: 'ascii' codec can't encode characters in position 177-179: ordinal not in range(128)
Call stack:
File "runankimac", line 12, in
File "aqt/init.py", line 262, in run
File "aqt/init.py", line 347, in _run
File "aqt/webview.py", line 27, in cmd
File "aqt/webview.py", line 85, in _onCmd
File "aqt/webview.py", line 346, in _onBridgeCmd
File "aqt/editor.py", line 268, in onBridgeCmd
File "anki/hooks.py", line 34, in runFilter
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit.py", line 61, in onFocusLost
if updateFields(note, field, allFields):
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit_behavior.py", line 469, in updateFields
update_all_Sound_fields(fieldsCopy[currentField], fieldsCopy)
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit_behavior.py", line 350, in update_all_Sound_fields
updated1, errors1 = update_Sound_fields(hanzi, dico)
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit_behavior.py", line 315, in update_Sound_fields
s = sound(hanzi)
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit_functions.py", line 410, in sound
return '[sound:%s]' % tts.download_sound(text, options[source])
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/tts.py", line 35, in download_sound
tts.save(path)
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/lib/gTTS/gtts/tts.py", line 247, in save
self.write_to_fp(f)
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/lib/gTTS/gtts/tts.py", line 230, in write_to_fp
log.debug("part-%i written to %s", idx, fp)
File "logging/init.py", line 1296, in debug
File "logging/init.py", line 1444, in _log
File "logging/init.py", line 1454, in handle
File "logging/init.py", line 1516, in callHandlers
File "logging/init.py", line 865, in handle
File "logging/init.py", line 1072, in emit
File "logging/init.py", line 1000, in emit
Unable to print the message and arguments - possible formatting error.
Use the traceback above to help find the error.
--- Logging error ---
Traceback (most recent call last):
File "logging/init.py", line 996, in emit
UnicodeEncodeError: 'ascii' codec can't encode characters in position 135-137: ordinal not in range(128)
Call stack:
File "runankimac", line 12, in
File "aqt/init.py", line 262, in run
File "aqt/init.py", line 347, in _run
File "aqt/webview.py", line 27, in cmd
File "aqt/webview.py", line 85, in _onCmd
File "aqt/webview.py", line 346, in _onBridgeCmd
File "aqt/editor.py", line 268, in onBridgeCmd
File "anki/hooks.py", line 34, in runFilter
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit.py", line 61, in onFocusLost
if updateFields(note, field, allFields):
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit_behavior.py", line 469, in updateFields
update_all_Sound_fields(fieldsCopy[currentField], fieldsCopy)
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit_behavior.py", line 350, in update_all_Sound_fields
updated1, errors1 = update_Sound_fields(hanzi, dico)
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit_behavior.py", line 315, in update_Sound_fields
s = sound(hanzi)
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/edit_functions.py", line 410, in sound
return '[sound:%s]' % tts.download_sound(text, options[source])
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/tts.py", line 35, in download_sound
tts.save(path)
File "/Users/rmi1/Library/Application Support/Anki2/addons21/1128979221/lib/gTTS/gtts/tts.py", line 248, in save
log.debug("Saved to %s", savefile)
File "logging/init.py", line 1296, in debug
File "logging/init.py", line 1444, in _log
File "logging/init.py", line 1454, in handle
File "logging/init.py", line 1516, in callHandlers
File "logging/init.py", line 865, in handle
File "logging/init.py", line 1072, in emit
File "logging/init.py", line 1000, in emit
Unable to print the message and arguments - possible formatting error.
Use the traceback above to help find the error.
Hi luoliyan,
Google TTS doesn't seem to produce proper sound files anymore on Anki version 2.1.5. Baidu TTS is producing sound.
Regards,
3ter
Original report: ttempe/chinese-support-addon#71
Commas seem to be handled correctly now, unlike in older version. But several issues remain:
If anyone has other examples, please post them here.
I created some new cards yesterday using the same process I've been using for months, but now each of the sound files either does not play or are just 0-second files, or they are silent files. Each generated file, regardless of the length of the sentence are just 132 bytes.
Changing the TTS engine in Anki->Tools->Chinese Support->Set speech egnine->Google TTS works fine but Baidu does produce superior pronunciation.
Mac Version:
10.13.2 (17C205)
Anki Version:
Version 2.1.0beta13
Qt 5.9.0 PyQt 5.8.2
Error message:
An add-on you installed failed to load. If problems persist, please go to the Tools>Add-ons menu, and disable or delete the add-on.
When loading 'Chinese_Support_Redux':
Traceback (most recent call last):
File "aqt/addons.py", line 58, in loadAddons
File "/Users/michaelfulton/Library/Application Support/Anki2/addons21/839350950/init.py", line 23, in
from . import edit
File "/Users/michaelfulton/Library/Application Support/Anki2/addons21/839350950/edit.py", line 10, in
from .config import chinese_support_config as config
File "/Users/michaelfulton/Library/Application Support/Anki2/addons21/839350950/config.py", line 32, in
chinese_support_config = ConfigManager()
File "/Users/michaelfulton/Library/Application Support/Anki2/addons21/839350950/config.py", line 14, in init
self.options = mw.addonManager.getConfig(name)
AttributeError: 'AnkiQt' object has no attribute 'addonManager'
Describe the bug
While I was adding new note it wrongly produced Pinyin for one common character in each word.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
It was expected to input 'kāi' or it's sound in all reading fields.
Screenshots
If applicable, add screenshots to help explain your problem.
Specs (please complete the following information):
Additional context
Add any other context about the problem here.
Describe the bug
When I click on Chinese -> Fill transcription and Color, then I get the following error message:
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 on the add-ons section of our support site.
Debug info:
Anki 2.1.5 Python 3.6.1 Qt 5.9.2 PyQt 5.9
Platform: Windows 7
Flags: frz=True ao=True sv=1
Caught exception:
File "E:\AnkiData\addons21\1128979221\fill.py", line 185, in fill_pinyin
results += update_Pinyin_fields(hanzi, note_dict)
File "E:\AnkiData\addons21\1128979221\behavior.py", line 143, in update_Pinyin_fields
format_Pinyin_fields(d)
File "E:\AnkiData\addons21\1128979221\behavior.py", line 130, in format_Pinyin_fields
True
<class 'TypeError'>: accentuate() takes 1 positional argument but 2 were given
To Reproduce
Steps to reproduce the behavior:
Expected behavior
It fills out my notes
Screenshots
Specs (please complete the following information):
Additional context
It looks a bit like #22
I've been experimenting with the code for this add-on a bit but I'm running into an issue where if I try to run a file in a console that contains a relative import statement (e.g. "from .hanzi import has_hanzi") I get a ModuleNotFoundError.
Anyone able to help me out? I'd love to participate more in the development of this add-on, but this error is making it hard to do any kind of testing.
Original request: ttempe/chinese-support-addon#60
Allow choices other than Jyutping.
Mac Version:
10.13.2 (17C205)
Anki 2.1.0beta32 Python 3.6.1 Qt 5.9.2 PyQt 5.9
Platform: Mac 10.13.2
Flags: frz=True ao=True
Caught exception:
File "/Users/michaelfulton/Library/Application Support/Anki2/addons21/839350950/fill_missing.py", line 267, in fill_simp_trad
if (has_field(Simplified_fields, note_dict) or has_field(Traditional_fields, note_dict)) and has_field(Hanzi_fields, note_dict):
<class 'NameError'>: name 'Simplified_fields' is not defined
Describe the bug
When creating a card with the Hanzi "答案" and using the Pinyin and Ruby generation functionality of this addon, the resulting Ruby output is wrong.
To Reproduce
Steps to reproduce the behavior:
HTML code of the ruby field:
<span class="tone4"><ruby>答<rt>dáàn</rt></ruby></span>
Expected behavior
The correct HTML would be:
<span class="tone2"><ruby>答<rt>dá</rt></ruby></span><span class="tone4"><ruby>案<rt>àn</rt></ruby></span>
Specs (please complete the following information):
Describe the bug
FIeld "color" does not get filled when a field with name "pinyin" is present.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
All fields should be filled regardless which other fields are present.
Specs (please complete the following information):
Describe the bug
When creating a new note, the note fails to pass the creation and formatting of fields. This can be solved locally by removing the extra 'True' argument being passed to the 'accentuate' function. This function is called in both format Pinyin and format Pinyin TW.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Notes should able to be created without error.
Once my studies advance a little more, I'd like to have the option to review certain cards with monolingual definitions (i.e., definitions in Chinese). Ideally, there exists a monolingual dictionary like CEDICT whose definitions we can use. I've already found http://www.zdic.net/z/, which seems to have a CC-Noncommercial license - perhaps that could be used.
Since updating to the latest versions of Anki and chinese-support-redux, when I try to use the "Fill Transcription and Color" feature Anki displays the following error message:
Caught exception:
File "/Users/MyName/Library/Application Support/Anki2/addons21/1128979221/fill.py", line 187, in bulk_fill_pinyin
results += bulk_fill_pinyin(hanzi, note_dict)
<class 'TypeError'>: bulk_fill_pinyin() takes 0 positional arguments but 2 were given
If I try to use the real time fill feature, (i.e. hitting tab after inputting Chinese characters to auto generate other fields) Anki just crashes or freezes.
Specs
Anki 2.1.8 (71e0c880) Python 3.6.7 Qt 5.12.0 PyQt 5.11.3
Platform: Mac 10.14.2
Flags: frz=True ao=True sv=1
I don't know anything about programming, but please let me know if there's any other information I can provide that will help.
Thank you!
AwesomeTTS has Sin-Ji (zh-HK) on OSX.
Android has TTS support via Google yue-Hant-HK and some other speech engines too, like Ekho.
For Google TTS the locale is:
new Locale("yue", "HK"); //yue for 粤语
This addon should be able to use a Cantonese text to speech engine.
Unlike with the old version of the add-on, this version doesn't seem to populate the classifier field. On my notes the field is entitled "Mean Word".
Describe the bug
Any time I close and re-open Anki, any edits I've made to the Add-on config file reset to default.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Changes to config file are persistent through restarts.
Screenshots
If applicable, add screenshots to help explain your problem.
Specs (please complete the following information):
Hi there,
As one character may have multiple pronunciations there are cases where the sound doesn't match the reading.
Regards,
3ter
Describe the bug
I know there is still work being done on improving the transcription, but this is potentially a low hanging fruit: I've noticed that sometimes including a punctuation character makes the transcription a lot more mediocre.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Punctuation doesn't affect transcription except to the extent that it indicates word separation.
Specs (please complete the following information):
OS: Mac Os X
Anki Version 2.1.7
Chinese Support Redux v091
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.