A simple anki addon to merge duplicate notes into a single note.
Install the addon from AnkiWeb or manually my cloning this repo in {Anki Directory}/addons21/
.
Select any number of notes/cards in the browser, right-click, and press "Merge duplicate notes".
Of all the selected notes, any duplicates (i.e. the first field being equal) will be merged together. The merging strategy can be configured, see below. The tags of all notes are combined, i.e. the merged note will have all the tags any of the original notes had.
Say for example you select these notes:
Word | Description | Audio | tags |
---|---|---|---|
banana | a long yellow fruit growing in tropical climates | very-important-tag | |
banana | a fruit | [sound:banana.mp3] | fruit, marked |
apple | a round, red or green fruit | fruit |
and press "Merge duplicate notes".
The first two notes, their first field being equal, will be detected as duplicates of each other. So these two notes will be combined into one note, whereas the "apple" note will remain untouched.
When two notes that get merged have different values in one field, the default strategy is to pick the longer one. In the example for the "Description" field, the first note has the longer value, so the merged note will have it's "Description" value. For the "Audio" field however, the second note has the longer value (the field being empty for the first note), so the merged note will have it's "Audio" value.
The tags will be combined of the two notes.
So the result will be:
Word | Description | Audio | tags |
---|---|---|---|
banana | a long yellow fruit growing in tropical climates | [sound:banana.mp3] | very-important-tag, fruit, marked |
apple | a round, red or green fruit | fruit |
Currently the configuration has only one option merge_mode
, it can be set to the following values:
longer
(default) – The longer content of the notes will be kept for the merged note, see above.concat
– The contents of both notes will be concatenated for the new note.first
– Keep the field contents of the first card only.skip
– Notes will only get merged if there are no conflicting fields. Merges will only happen if for all fields both notes have the same value or one note has no value.
If you are comfortable with Python and want to change something, you should be able to just change the addon yourself, it's very small. Click "View files" in the addon menu in Anki to get to the folder, and open __init__.py
.
Note: If you have installed the addon from AnkiWeb, if I ever push an update of the addon there, any local changes will be overwritten when it gets updated. If you install the addon manually, this will not happen.
I (Garbaz) no longer use Anki.
If you want to see a feature added or a bug fixed, have a go yourself and send a pull request :) This add-on really is very simple, so even if you have never worked on an Anki add-on, don't be shy! ^^
To get started, take a look at the official introduction, and the source code for aqt
and anki
as an API reference.