Created
July 11, 2017 01:46
-
-
Save allanlw/fb80d85c15036a089bc31a6c41227ee9 to your computer and use it in GitHub Desktop.
anki-dupes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Quick script for finding cards that are dupes based on the sort field | |
from collections import defaultdict | |
q = defaultdict(list) | |
for (k,v) in [ (anki.utils.stripHTML(y.fields[y.col.models.sortIdx(y._model)]), y) for y in [mw.col.getNote(x) for x in mw.col.findNotes("deck:Japanese")]]: | |
q[k].append(v) | |
dupes = [(k,v) for (k,v) in q.items() if len(v) > 1] | |
for k,vs in dupes: | |
for b in vs: | |
b.addTag("allandup") | |
b.flush() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment