CompreDef

AnkiWeb addon 1619602654

Generates Japanese definitions matching the reader's known kanji and vocabulary by scoring and selecting the most comprehensible entry from local Yomitan dictionaries, in the editor or in bulk.
AI-generated summary; may contain mistakes.

card-creationsync-integrationnote-managementdictionary

Open on AnkiWeb GitHub Find alternatives

AnkiWeb

Votes
0 (πŸ‘ 0 Β· πŸ‘Ž 0)
Updated
2026-10-06
Anki versions
26.08~
License
GPL-3.0 (from the README)
Virus scan
No ClamAV match A match does not prove malware. No match does not prove that the code is safe.
Languages
Python, JSON
Description language
en

Maintenance

active

  • Last update or commit: 2026-10-08 (24 days before the snapshot).
  • Test files: 2.
  • GitHub Actions workflows: 2.
  • Commits in the last year: 183.
  • Issues: 0 open, 0 closed.
  • Pull requests: 0 open, 2 merged.

Will it work on my Anki?

Version branches
Min AnkiMax AnkiUpdated
23.1026.08+2026-10-06
History across monthly snapshots

Loading…

Similar addons

Japanese Note Auto-Generator

Auto-generates Japanese vocabulary notecards from a word list via the Jisho.org API, including definitions, readings, JLPT level, kanji explanations, furigana and example sentences, placed in a custom deck.

card-creationdictionary

2 votes 0% approval πŸ‘ 0 Β· πŸ‘Ž 2 Anki 2.1.16~ Updated 2021-05-23
Japanese Bulk Card Creator

Creates bulk Japanese vocabulary and phrase flashcards from kanji or words using a bundled dictionary, with field mapping, configurable Hepburn romanization, and optional Jisho audio downloads.

card-creationdictionary

1 votes 21% approval πŸ‘ 1 Β· πŸ‘Ž 0 ⭐ 0 Anki 25.09.2~ Updated 2025-11-06
Kanji Unlock Addon

Automatically unsuspends kanji cards whose kanji appear in already-learned vocabulary words, optionally including component radicals, helping align vocabulary and kanji study progress.

review-flownote-managementdeck-management

4 votes 51% approval πŸ‘ 4 Β· πŸ‘Ž 0 ⭐ 1 Anki 2.1.33~ Updated 2020-09-15

Description

Generates Japanese definitions tailored to your known kanji and vocabulary. It compares definitions from your dictionaries and picks the one that best matches what you already know from your Anki collection. Supports local Yomitan dictionaries (folders or ZIPs), with optional Yomitan API support. Definitions can be generated from the editor or in bulk from the Browser. Pure local SQLite lookups β€” no LLMs, no network calls.

README

CompreDef

Anki add-on for automatically generating Japanese vocabulary definitions strictly tailored to your known vocabulary and kanji levels.

Download from AnkiWeb

Core Concept: One Score for Every Definition

CompreDef frees you from the circular lookup trap of Japanese monolingual dictionaries by scoring every definition from every dictionary you install β€” and returning the most readable one:

  • Every dictionary contributes its candidates for the word.
  • Each candidate is scored with comprehension density: the fraction of its kanji and compounds you already know (from your mature Anki cards).
  • The highest score wins, regardless of which dictionary it came from.

Recommended setup: install the richest dictionaries you can almost read (e.g. δΈ‰ηœε ‚ε›½θͺžθΎžε…Έ, ε€§θΎžζ³‰) alongside simpler ones (e.g. 小学逨例解学習国θͺž). You get the most readable definition available, and as your knowledge grows, more words naturally resolve to the richer sources.

The score counts kanji and multi-kanji compounds; kana is treated as known β€” so succinct explanations of known kanji beat long walls of unknown ones.

For an in-depth mathematical specification and flowcharts, see the Algorithm Specification Wiki (WIKI.md).


Features

  • Dictionary Management: Add, remove, and reorder dictionaries using Move Up/Down buttons or native Drag-and-Drop.
  • Folder Auto-Scanner: Point CompreDef at a folder containing multiple unzipped Yomitan dictionaries to auto-detect and add all of them.
  • ZIP Archive Support: Add Yomitan dictionaries directly as .zip files for zero-disk footprint and instant loading.
  • Auto-Matching Fields: Automatically detects and maps your Target Word (Expression, Word) and Definition fields.
  • Card Editor Button: One-click definition generation directly inside Anki's card editor toolbar.
  • Bulk Generation: Generate definitions for hundreds of selected cards at once from the Anki Browser (via Edit -> Generate CompreDef Definitions... or Ctrl+Shift+D).
  • Independent Disk Caching: Each dictionary is parsed once and cached in user_files/cache/dictionaries.db, enabling instant (0.08ms) B-tree lookups and instant reordering without re-parsing.
  • 100% Faithful Yomitan HTML: Renders rich Yomitan structured-content with <ruby>, data-sc-* attributes, inline CSS, and 用例 blocks directly into Anki notes.

Installation

  1. Download or build CompreDef.ankiaddon (see Testing & Local Installation below).
  2. In Anki: Tools β†’ Add-ons β†’ Install from file... β†’ select it β†’ restart Anki.
  3. Configure your Note Type and Dictionaries under Tools β†’ Add-ons β†’ CompreDef β†’ Config.

Configuration

  1. Note Types & Field Mappings: Check every note type CompreDef should generate definitions for (e.g., Japanese, Mining, Animecards). Select a type's row to map its fields β€” each type keeps its own Word / Reading / Definition fields, auto-matched from the type's schema. Unchecked types are ignored by generation.
  2. Dictionaries:
    • Click Add Zip Archive... to select a Yomitan .zip file.
    • Click Add Folder... to select an unzipped dictionary folder.
    • Click Scan Folder... to select a parent folder containing multiple dictionaries (both .zip files and subfolders).

Testing & Local Installation

Run the regression suite (no Anki/PyQt needed β€” the Anki API is stubbed automatically; real-dictionary smoke tests self-skip if the dictionaries are absent):

python3 tests/test_regression.py

Build the installable package to test the current code in Anki:

./scripts/build.sh        # β†’ dist/CompreDef.ankiaddon

Then install it: Anki β†’ Tools β†’ Add-ons β†’ Install from file... β†’ select dist/CompreDef.ankiaddon β†’ restart Anki.

Prefer a live checkout while developing? Symlink the repo instead of installing the package:

ln -sfn /path/to/CompreDef ~/.local/share/Anki2/addons21/CompreDef

For test + commit + push + full release in one go:

./scripts/ci.sh          # β†’ GitHub Release + AnkiWeb upload via CI

For a full release with an explicit version:

./scripts/release.sh [vX.Y.Z]

Testing a released change (no manual installs):

  1. Restart Anki β€” the add-on update check fires.
  2. Anki detects the new version β†’ "Update All" / auto-installs (~1s download).
  3. Restart Anki again β€” the new code is active.
  4. Test the feature.

The regression suite verifies (among others) that definitions stay rich Yomitan HTML (never plain text), furigana readings never pollute kanji scoring, every definition is ranked with one density logic regardless of dictionary order, cross-reference titles lose to real definitions, .zip archives produce byte-identical output to their unzipped folders, and Tab-to-Generate never overwrites an existing definition.


Architecture & Code Structure

CompreDef/
β”œβ”€β”€ __init__.py         # Add-on entry point & hook registration
β”œβ”€β”€ gui.py              # Config dialog, Scope picker, Learner Knowledge window
β”œβ”€β”€ editor_browser.py   # Editor button, Tab-to-Generate, Browser bulk actions
β”œβ”€β”€ core.py / engine.py # Wiring/singletons; definition generation
β”œβ”€β”€ picker.py         # Self-contained picking strategies (density argmax)
β”œβ”€β”€ scoring.py          # Interval-weighted kanji/vocab scoring + filters
β”œβ”€β”€ anki.py             # Learner-knowledge snapshot (native DB wrapper only)
β”œβ”€β”€ scope.py            # Deck Scope (drives generation + knowledge)
β”œβ”€β”€ provider.py         # DictionaryProvider interface + SQLite implementation
β”œβ”€β”€ renderer.py / models.py / utils.py  # Yomitan HTML, data types, helpers
β”œβ”€β”€ parser.py           # Compat layer over provider/renderer/utils
β”œβ”€β”€ yomitan.py / yomitan_installer.py    # Optional Yomitan-API source + bridge
β”œβ”€β”€ PRODUCT.md / MVP.md / ARCHITECTURE.md / QUALITY.md  # What / scope / how / invariants
β”œβ”€β”€ TEST_STRATEGY.md / IMPLEMENTATION_PLAN.md / AGENTS.md  # Verification / work / agent ops
β”œβ”€β”€ tests/
β”‚   └── test_regression.py  # Fundamental regression suite (run before committing)
β”œβ”€β”€ debug/              # On-demand diagnostics (never shipped, never in CI)
β”œβ”€β”€ icons/              # UI toolbar icons (compredef.svg)
β”œβ”€β”€ config.json         # Default configuration settings
└── WIKI.md             # In-depth algorithm & architecture wiki

Development & Safety Rules

  • CI/CD: Use ./scripts/ci.sh for testing and pushing, and ./scripts/release.sh for tagged releases.
  • AnkiWeb Publishing: Upon creating a GitHub Release, the danny900714/upload-anki-addon action automatically updates the AnkiWeb listing (1619602654). Ensure ANKI_WEB_USERNAME and ANKI_WEB_PASSWORD secrets are configured in the repository.
  • Native DB Access Only: Never open collection.anki2 with raw sqlite3. CompreDef strictly uses mw.col.db to prevent database locks.
  • Non-Blocking Concurrency: All dictionary parsing and scoring operations execute in background threads using mw.taskman.run_in_background().
  • PyQt Compatibility: Imports use aqt.qt for multi-version Qt compatibility.
  • SQLite Caching: Dictionary lookups use indexed B-tree tables in user_files/cache/dictionaries.db for ~0.08ms performance with 0MB RAM footprint.

Support

Building small, useful software β€” if this project saves you time, consider buying me a coffee to help keep it maintained.

Buy Me A Coffee

License

GNU General Public License v3 or later.