Last active
February 11, 2023 20:18
-
-
Save eshapard/960f2508c2096ff663af3b6ebc925f16 to your computer and use it in GitHub Desktop.
Anki 2.0 addon to dynamically create learning steps. Starting at 15 minutes and then one day, each additional step is `easeFactor * lastStep` until we pass 20 days. Sets graduating and *Easy* interval to the next logical interval in the series. See this post for rationale: https://eshapard.github.io/anki/anki-learning-steps-with-feedback.html
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
# Auto Learning Steps | |
# Anki 2.0 addon | |
# Author EJS | |
# https://eshapard.github.io/ | |
# | |
# Sets the learning steps sequence of each deck options group. | |
from anki.hooks import addHook | |
from aqt import mw | |
#from aqt.utils import showInfo | |
#import time | |
ignoreList = ['Default', 'OnHold', 'Parent Category'] #Deck options groups to ignore | |
# run this on profile load | |
def updateLearningSteps(): | |
#find all deck option groups | |
dconf = mw.col.decks.dconf | |
#cycle through them one by one | |
for k in dconf: | |
if dconf[k]["name"] not in ignoreList: | |
#showInfo(dconf[k]["name"]) | |
ease = dconf[k]["new"]["initialFactor"]/1000.0 | |
#create learning steps | |
tempList = [15] | |
for i in range(10): | |
l = int(1440*ease**i) | |
if l < 28800: | |
tempList.append(l) | |
else: | |
gradInts = [int(l/1440),int(l/1440)] | |
break | |
#showInfo(str(tempList)) | |
#showInfo(str(gradInts)) | |
mw.col.decks.dconf[k]["new"]["delays"] = tempList | |
mw.col.decks.dconf[k]["new"]["ints"] = gradInts | |
mw.col.decks.save(mw.col.decks.dconf[k]) | |
mw.reset() | |
# add hook to 'profileLoaded' | |
addHook("profileLoaded", updateLearningSteps) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you! 👍
Also helped me a lot to understand the code better! :)