Anki 2.1 add-on
This add-on allows you to search the CC-CEDICT dictionary
and automatically add cards to your decks. You can download it here.
Anki 2.1 add-on
License: MIT License
I think it may be possible to avoid asking users to select what the input type is ( simplified, traditional, English).
For example, can the code search for results assuming one type at a time until it finds matches?
I saw this message today while debugging an issue.
I am on Mac.
(python-3.8.5)[~/oss/cc-cedict-for-anki (debug-note-type-issue *)]$ /Applications/Anki.app/Contents/MacOS/Anki
mpv too old for key rebinding
Qt WebEngine resources not found at . Trying parent directory...
Qt WebEngine resources not found at /Applications/Anki.app/Contents/MacOS/PyQt5/Qt. Trying application directory...
Installed Qt WebEngine locales directory not found at location /qtwebengine_locales. Trying application directory...
qt.qpa.fonts: Populating font family aliases took 134 ms. Replace uses of missing font family "KaiTi" with one that exists to avoid this cost.
Debug info:
Anki 2.1.44 (b2b3275f) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
Platform: Mac 10.16
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2022-08-12 20:06:34
Add-ons possibly involved: CC-CEDICT for Anki Chinese dictionary
Caught exception:
Traceback (most recent call last):
File "/Users/kati/Library/Application Support/Anki2/addons21/418828045/cedict/main.py", line 382, in init_add
self.add_note([simp, trad, pinyin, english], input_type, tags)
File "/Users/kati/Library/Application Support/Anki2/addons21/418828045/cedict/main.py", line 325, in add_note
n.add_tag(tags)
AttributeError: 'Note' object has no attribute 'add_tag'
This first image shows an example of a word for which I tried to create a note but the mapping failed (电影). Note the set-up of the fields: the note should have the English meaning, the pinyin, and then the characters. This ordering is certainly correct for my notetype, and it works for most (probably ~95%) additions through CC-CEDICT.
However, the created note is all wrong:
I was searching some words close to their Pinyin form, but not exact, leading to an error as shown.
Full debug info:
Debug info:
Anki 2.1.53 (96bacf79) Python 3.9.7 Qt 5.15.2 PyQt 5.15.5
Platform: Windows 10
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2022-06-01 17:51:41
Caught exception:
Traceback (most recent call last):
File "C:\Users\D\AppData\Roaming\Anki2\addons21\418828045\cedict\main.py", line 255, in search
self.exact_match(query, "eng")
File "C:\Users\D\AppData\Roaming\Anki2\addons21\418828045\cedict\main.py", line 210, in exact_match
self.first_result()
File "C:\Users\D\AppData\Roaming\Anki2\addons21\418828045\cedict\main.py", line 268, in first_result
simp = self.dialog.Results.item(0, 0).text()
AttributeError: 'NoneType' object has no attribute 'text'
Caught exception:
Traceback (most recent call last):
File "C:\Users\D\AppData\Roaming\Anki2\addons21\418828045\cedict\main.py", line 255, in search
self.exact_match(query, "eng")
File "C:\Users\D\AppData\Roaming\Anki2\addons21\418828045\cedict\main.py", line 210, in exact_match
self.first_result()
File "C:\Users\D\AppData\Roaming\Anki2\addons21\418828045\cedict\main.py", line 268, in first_result
simp = self.dialog.Results.item(0, 0).text()
AttributeError: 'NoneType' object has no attribute 'text'
The word being searched in this image is dian. Searching for an English word (shop) works fine.
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 2.1.65 (aa9a734f) Python 3.9.15 Qt 6.5.0 PyQt 6.5.0
Platform: macOS-13.4.1-arm64-arm-64bit
Flags: frz=True ao=True sv=3
Add-ons, last update check: 2023-07-03 21:37:09
Add-ons possibly involved: CC-CEDICT for Anki Chinese dictionary
Caught exception:
Traceback (most recent call last):
File "/Users/maikbraun/Library/Application Support/Anki2/addons21/418828045/cedict/main.py", line 382, in init_add
self.add_note([simp, trad, pinyin, english], input_type, tags)
File "/Users/maikbraun/Library/Application Support/Anki2/addons21/418828045/cedict/main.py", line 329, in add_note
note_ids_english = col.find_notes("{}:{}".format(english_field_name, english))
File "anki.collection", line 696, in find_notes
File "anki._backend_generated", line 1544, in search_notes
File "anki._backend", line 156, in _run_command
anki.errors.SearchError:
Invalid search: an or
was found but it is not connecting two search terms. If you want to search for the word itself, wrap it in double quotes: "or"
.
Hello, thanks for the great tool for Chinese learner Anki user!
Recent update added the option to insert many words comma separated.
Pls also add the ability to input arrays of word separated by other common marks like linefeeds (it's classic word list exported by huge amount of different programs/plugins) or (semi)colons, tabs etc.
If it's possible then make it user-defineable which symbol is used to separate words.
Would it be possible to add cantonese support using the CC-Canto, including jyutping? I don't know if it'd be better to have both in the same extension, or separate ones.
With the latest change, it appears that it will ask users to select field mappings again after anki is restarted.
In my case, I have designed a note type with the exact 4 field names.
This is inconvenient.
I really like the way this HSK deck colours its pinyin according to tone; https://ankiweb.net/shared/info/1855818143 It makes absorbing the tones much easier.
It uses an html element with class= tone1, tone2, tone3 or tone4 and uses CSS in the card template accordingly.
Perhaps card templates can't be controlled by this addon, however I think it shouldn't be too complicated to add html elements to the pinyin and you could advise users in the instructions to add CSS styling if they want to.
How to recreate: Add a new word using the pop-up dialogue box.
Expected behaviour: A message should tell you that a note has been added. Or, if the note type you've selected has more than one card type associated with it, the message could tell you how many cards were created.
Actual behaviour: A message tells you that "1 new card was added", which is not true if the note type has more than 1 card type.
Just a text box where you could type in some tags and they would be added to the tag field of the created note.
The word I'm trying to add: 同归于尽 (although this has happened before, I just didn't bother to report it)
My action: search for the word, click on it, click 'Add card(s)'
Expected behaviour: The word is added to my notes (it works for 99.9% of words still)
Actual behaviour: I get this 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 to the add-on author.
Debug info:
Anki 2.1.54 (b6a7760c) Python 3.9.10 Qt 6.3.1 PyQt 6.3.1
Platform: Linux
Flags: frz=True ao=True sv=3
Add-ons, last update check: 2022-09-21 09:39:31
Add-ons possibly involved: CC-CEDICT for Anki Chinese dictionary
Caught exception:
Traceback (most recent call last):
File "/home/lk/.local/share/Anki2/addons21/418828045/cedict/main.py", line 382, in init_add
self.add_note([simp, trad, pinyin, english], input_type, tags)
File "/home/lk/.local/share/Anki2/addons21/418828045/cedict/main.py", line 329, in add_note
note_ids_english = col.find_notes("{}:{}".format(english_field_name, english))
File "anki.collection", line 646, in find_notes
File "anki._backend.generated", line 1477, in search_notes
File "anki._backend", line 146, in _run_command
anki.errors.SearchError:Invalid search: an
or
was found but it is not connecting two search terms. If you want to search for the word itself, wrap it in double quotes:"or"
.
Anki Version 2.1.46 (94913ec2)
When installing from file either by opening the .ankiaddon file directly in Anki or using the Addon Manager within Anki, I get the following error message "Error installing CC-CEDICT-for-Anki-v1.3-beta.ankiaddon: Invalid add-on manifest."
It's great to see a new pre-release version 1.3 Beta. I am looking forward to using it!
When do you plan to release it to the addon page https://ankiweb.net/shared/info/418828045?
In the meantime, is there a way to try it?
My cards are being generated the the definition field separated by single spaces, which make them confusing and hard to read for words containing multiple definitions (most). I am not sure why since definitions within the add-on window are comma-separated, still cards appear with single spaces only.
Another thing, which I hope is simple to implement, would be to position the cursor on the search bar when opening the add-on, since that is pretty much the only thing people want to use when opening it. Right now it is necessary to use the mouse and click there every time (tab does not get there).
Sorry, for combining multiple suggestions in one post. Finally, I would like to know if it is possible to select the fields used for duplicate checking? or it is up to Anki only? My problem is that I have cards added from other apps or manually. This add-on will readily add duplicates even when simplified and traditional fields are the same, so long as definition fields is different. For example the dictionary on my phone will add cards with definitions that are separated by a symbol or a semicolon (from CC-CEDICT too), and this add-on add them separated by spaces and counts them as different cards. If possible I would select either simplified or traditional fields for duplicate checking only, so even if definitions differ the add-on can warn me these are duplicates.
Cheers.
At the moment the minimum window size is over half the width of my screen. It would be good to have the window in the corner of the screen while your Chinese content takes up most of the rest of the screen.
This might cover up some of the buttons and menus, but once you've selected the card type and deck, all you really need is the search functionality, a preview, and the 'Add Card(s)' button.
Hi, the add-on had been working just fine until I updated yesterday. Now everytime I add a card it won't work and says "Each field could only be used once". Do you know how to resolve this?
Thanks
I found this tool a great time saver for me. Thanks for sharing it!
I typically would add a few phrases at a time. It would be great if this tool can have a batch input mode. This will further reduce the number of manual work.
Here is one possible design I can think of:
If the input contains multiple phrases separated by space, the batch input mode is turned on automatically and the exact match mode is used automatically to search each phrase.
If a match is found, it will be displayed in the list below the search box.
The ones that can't find a match will be displayed below the matched list.
When the add button is clicked, the matched ones will be added.
What do you think?
Thanks for creating this tool!
I tried it today. It worked for me.
The only problem I have seen so far is that it doesn't allow me to change the desk after the initial test.
I've tried deleting the addon and reinstalling it/ changing the config.
After I delete the test desk, it creates new cards in a deck that I don't seem to have control anymore. For example, it currently saves only to the default desk.
My version:
v1.2 (14.02.2020):
Version 2.1.33 (3f403040) on Mac
Python 3.8.0 Qt 5.14.2 PyQt 5.14.2
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.