Anki Addon: Ignore Dupes
Duplicates in Anki
By default Anki checks for duplicates as follows (see the anki manual).
Anki checks the first field for uniqueness, so it will warn you if you enter two cards with a Front field of “apple” (for example). The uniqueness check is limited to the current note type, so if you’re studying multiple languages, two cards with the same Front would not be listed as duplicates as long as you had a different note type for each language. Anki doesn’t check for duplicates in other fields automatically for efficiency reasons, but the browser has a “Find Duplicates” function which you can run periodically.
While this functionality usually is very handy, there are a few cases where some tweeks are nescessary: For example one might want to have more than one source deck (e.g. imported from anki web), all of which use the same note type. In this case every word that appears in more than one source deck would be flagged, as well as any words that I added to my normal review deck which appear in one other source deck. This is of course undesirable.
With this addon the function that checks for duplicates can be tweaked to ignore dupliates based on the decks they belong to. E.g. one could ignore all duplicates where at least one card belongs to a deck with "DUPLICATE" in the name.
Via the Anki interface (this might not be the newest version!) Main Window:
Browse & Install..., then enter the code
1919904593in the pop up window.
Manually. Click here here to download the newest version of this addon as a ZIP file, then move the contents of the ZIP folder (the file
ignore_dupes.pyand the folder
ignore_dupes_files) to the
addonsubfolder of your Anki directory.
<path to your account>/Documents/Anki/addons.
Via the Anki interface. Main Window:
Manually: Delete the file
ignore_dupes.pyand the folder
ignore_dupes_filesfrom your addon folder.
For debugging purposes, this addon generates a log in the folder
ignore_dupes_files (which you just moved into the addon folder), called
If the logging level is set to
DEBUG, the contents look something like this:
IgnoreDupes:INFO:Plugin 'ignore_dupes' active. Some duplicated card warnings may be surpressed. IgnoreDupes:DEBUG:Log will be saved at /home/fuchur/Documents/Anki/addons/ignore_dupes_files/ignore_dupes.log IgnoreDupes:DEBUG:key field = '<span class="Apple-tab-span" style="white-space:pre"> </span>一般的に言って' IgnoreDupes:DEBUG:other_note_ids:  IgnoreDupes:DEBUG:Did not find any notes with the same key field checksum as self. IgnoreDupes:DEBUG:key field = 'test' IgnoreDupes:DEBUG:other_note_ids:  IgnoreDupes:DEBUG:self_deck_ids  IgnoreDupes:DEBUG:other_deck_ids  IgnoreDupes:DEBUG:Duplicate! deck1 = 'JA::VOCAB', deck2 = 'JA::VOCAB::vocab_new' ==> Ignored. IgnoreDupes:DEBUG:key field = 'test' IgnoreDupes:DEBUG:other_note_ids:  IgnoreDupes:DEBUG:self_deck_ids  IgnoreDupes:DEBUG:other_deck_ids  IgnoreDupes:DEBUG:Duplicate! deck1 = 'JA::VOCAB::vocab_new', deck2 = 'JA::VOCAB' ==> Ignored.
If you run Anki from the command line, the first two lines will also always be displayed.
You can adjust the debug levels in the file
log.py. Available levels are
CRITICAL. The relevant lines are:
logger.setLevel(logging.INFO) # which log messages are recorded at all # (overall log level) sh_info.setLevel(logging.INFO) # which log messages are displayed in the command line sh_error.setLevel(logging.ERROR) # which log messages cause anki to display # a warning message fh.setLevel(logging.DEBUG) # which log messages are written to the log file
by default the overall logging level is set to
DEBUG as this performs etter. Thus, for more detailed information, simply replace the line
logger.setLevel(logging.DEBUG) and the log file will contain all debug information.
Done in the file
config.py of the folder
#!/usr/bin/env python # -*- coding: utf-8 -*- from examples import * (...) ignore_duplicates = ignore_nothing
the last line sets the function which determines which duplicates are ignored and which are flagged.
There are a lot of examplary functions in the file
An easy example can look like this:
def ignore_same_deck(deck1, deck2): if deck1 == deck2: return False else: return True
to load this function (which ignores all duplicates which belong to different decks), simply set
ignore_duplicates = ignore_same_deck
in the file