Wiktionary Add-on

Anki add-on to look up words offline using Wiktionary data downloaded from https://kaikki.org

See Wiktionary - AnkiWeb for downloading and instructions.

Please post any questions or issues you have here, or in GitHub.

3 Likes

Wow! You’re my hero…Been needing this for a very long time :smiley:
Wondering why Chinese isn’t working though. Swedish and any other language I’ve tried do, however.


The following errors happened during the process:

failed to write file of word "PS/2接口": [Errno 2] No such file or directory: '/home/yaoberh/.local/share/Anki2/addons21/2087444887/user_files/Chinese/PS/2接口.json'

Mandarin json shows that no definitions could be found, and Chinese gives me this error

EDIT:
For those using linux, rename any file with ⁄2 manually, by making the file yourselves. Because it registers it as a folder otherwise. Fixed!

The add-on ignores and reports issues with files that have problematic characters like /, which can’t be used in filenames (because it generates files for each entry in the imported dictionary).

Forbidden characters in filenames on Windows are the following:
image

Linux is less restrictive about filenames.

The importing process should work normally for other words, though.

Hello,
Is it possible to modify the script to accept .zim files? Or to make available addons for foreign versions of wikiword so that we get definitions in our target language?

Adding support for .zim files should be possible. I’ve added this to the todo list to look into. This will allow importing far more dictionaries.

kaikki.org only provides the English Wiktionary’s dictionaries currently. The zim files at wiki.kiwix.org include content from all supported languages, though.

Thank you for your reply!
If/when Zim files become usable for your add on, is it possible to combine the addon with the Create subs2srs cards with mpv video player addon(1213145732 )? This works in a way where you can instantly hit a hot key to take the audio line, subtitle, and screenshot from a video and create an anki card, not interrupting your watch time hardly at all, whereas with other mpv based methods you need to.
Would it be possible to somehow combine the two to where you can click on a subtitle word on the screen instead of the hotkey and then have that word with its definition from a wiki (in my case the greek language wikiword zim that I have from kiwix) be added to the anki card as well as the other items like the subtitle line, screenshot and other items? I am not a coder so I do not know how complex this would be on the back end. I’d be happy to commission this through your Fiver if need be.

1 Like

mpv’s interface is mostly keyboard-driven, so I’m not sure if it’s possible/easy to write a script that responds to mouse clicks and determine the word under the cursor. Hooking Wiktionary into the “Create subs2srs cards with mpv video player” add-on should be possible, though (Will require changes from both add-ons). Feel free to contact me through Fiverr - I’ll do some research and let you know if if this possible.

1 Like

Getting “Not found in dictionary” for every word in my chinese deck (3000 words).
Tried fetching from both Traditional and Simplified fields.

The following issues happened during the process:
“老师” was not found in the dictionary.

Tried with Chinese and Mandarin jsons. Any ideas?Thanks for the help

You are trying to import the JSON at the bottom of this page and this, right? Will test it and see what is the issue.

(If you can share your vocabulary deck, that would be nice for quick testing)

This is probably correct. 老师 doesn’t exist in the JSON files provided by kaikki.org.

Apple forbids most of those in filenames. Some of them it allows but you have to escape them to put them there.

Yeah, I’m using the json file at the bootom of both Chinese and Mandarin.
It doesn’t work with any word, not just 老师
This is my deck:

It doesn’t work for the Mandarin file because that file apparently mostly has entries for the pinyin transcriptions, and not the Chinese characters. See Mandarin word forms: list

Regarding the Chinese file, the add-on fails to find about 900 words. Those don’t exist on Kaikki (I only checked a few, but it’s most likely the case.)

Oh…that makes total sense if it tries to fetch pinyin…
Strange thing is, I got this wordlist from wiktionary. They’re the most used words in mandarin. Strange they do not show up in kaikki.
Is there any other dictionary I could try?
If not, I’ll wait for any updates for zim files and then try the one from your link above.

Thanks for the help!

It probably has something to do with the fact that those missing words only have redirects to synonyms in their pages in Wiktionary. See 老师 - Wiktionary for example.
Hopefully, the zim files are structured differently.

1 Like

Makes sense…

Hello, I am experience issues attempting to use your add-on. I imported a json file, add a note, click the W button, select the dictionary, then press add but there is an errorr saying “” was not found in the dictionary.

Did you make sure the Word field you selected is the correct one and is not empty?

I understood it now, thank you.