Skip to content

Plugin for Anki to help with learning Japanese: Syncs information between kanji decks and vocabulary decks.


Notifications You must be signed in to change notification settings


Folders and files

Last commit message
Last commit date

Latest commit



44 Commits

Repository files navigation

Syncing fields between Anki notes.

Overview over my other Anki add-ons

Plugin for Anki, a spaced repetition flashcard program. Some basics: Anki manual.

This Addon requires substantial configuration/adaptation to work for you. Rudimentary knowledge of python will be helpful. Note that the target fields of the target notes will be overwritten, so please be careful!

Use case

This plugin was designed for the following scenario: When learning Japanese, one usually deals with at least two different kinds of notes/decks:

  1. One for the Chinese characters (Kanji), containing information such as meaning, reading (pronounciation) and mnemotics for each of them
  2. One for vocabulary words which are written with Kana (syllable symbols) Kanji (a word can be written with none, or more than one Kanji, see wiki: Japanese writing system)

This addon exchanges information between both sets of notes:

  1. Kanji → Vocabulary: Adds information about the kanji that are used in the writing of the word to a new field of the vocabulary note
  2. Vocabulary → Kanji: Adds exampless of (already learned) words that use this kanji in its writing to a new field of the kanji note

Implemented example

  1. Kanji → Vocabulary: The word 不思議, read ふしぎ (fushigi) is written with three kanji , , and . All three kanji are found in the deck for kanji readings, and mnemotics for the onyomi of , and were found. Those were written to the field in row O by this plugin (prefixed with for Onyomi, 音読み). The examples in the X row are generated by Anki's Japanese plugin.


  2. Vocabylary → Kanji. My reading card of the kanji . First of all this was one of the notes whose information was transferred to the note 不思議 (the mnemotic for its reading was copied). In my vocabulary decks several already learned words with this kanji were found, e.g. 会議. These were written to the field in the row X by this plugin. The last symbol in square brackets (e.g. [本]) stands for the vocabulary deck where the words were found.


Code overview

This project has the following structure:

├── sync_fields_files
│   ├──         <-- empty (so that this becomes a module)
│   ├──              <-- builds the two Sync objects and 
│   │                           connects them to Anki via hooks
│   ├──             <-- defines Sync base class
│   ├──     <-- Defines subclass of Sync to sync vocabulary → kanji
│   ├──     <-- Defines subclass of Sync to sync kanji → vocabulary
│   ├──             <-- useful functions
│   └──              <-- sets up log
└──          <-- loads run

The top level file loads the file, which builds an object of type ExampleSync and ReadingSync and connects them to Anki via hooks. Both classes are subclasses of the class Sync, defined in The class Sync also contains the database that temporarily stores all information that is nescessary for the sync.

Almost all of the interesting code is already implemented in the Sync class, the subclasses only

  1. Fill in all the parameters (which decks/notes are to be synced to which decks/notes) etc.
  2. Implement the function format_target_field_content, which formats the string that is written to the target field of a target note, based on the database entries that correspond that note's kanji's.


This plugin will always save a log sync_fields.log, which should be located in this plugin's directory (sync_fields_files).

There is also a switch dump_database_after_full_loop = False in If set to True, the full database will be dumped as a string to the log file after Sync.loop_source_notes was called (i.e. after a full loop over all source notes was performed). This may however not perform well (which is why it is disabled by default).


The contents of this repository are licensed under the AGPL3 license (to be compatible with the license of Anki and its addons as detailed here).


Plugin for Anki to help with learning Japanese: Syncs information between kanji decks and vocabulary decks.




Code of conduct





No releases published


No packages published