Giter VIP home page Giter VIP logo

cc-cedict-for-anki's Introduction

CC-CEDICT for Anki

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.

cc-cedict-for-anki's People

Contributors

happyray avatar plsplsplslol avatar thorebor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cc-cedict-for-anki's Issues

Feature: auto detect input

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?

KaiTi font family not found

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.

Something doesn´t work, I dont know if it´s my fault

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'

Some vocab entries don't map correctly to the note's fields

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.

image

However, the created note is all wrong:

image

  • Whether a note is successfully created or not from each vocab item seems fixed: for the ones that failed, trying again always leads to failure, and for the ones that succeed, trying again always leads to success.
  • I think that the failure is probably to do with having multiple classifiers listed together in the English definition. The failures that I examined all had this in common (and were incorrectly split across the fields between the different classifiers listed), and I did not spot a note that was successfully created and had multiple classifiers listed together.

Issue Using the Search Feature in CC-CEDICT Add-on

I was searching some words close to their Pinyin form, but not exact, leading to an error as shown.

image

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.

Anki reports an error an requests a restart while looking up words

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".⁩

Feature request: recognize multiple words separated by tab, colons, linefeeds (new line marks)

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.

Cantonese support

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.

Feature: Colour pinyin according to tone

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.

Bug: "1 new card was added"

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.

Adding some words causes an error

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".⁩

v1.3-beta: Error when attempting to install

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.⁩"

definition field contains commas but cards are created without them (only a space separating definitions), they are hard to read. Also, can the cursor be positioned on the search bar when opening the add-on window?

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.

Make it possible for the window to be resized to a smaller size

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.

"Each field could only be used once" issue

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

Feature: batch input mode

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?

Doesn't respect the deck field

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.