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) |
Ah yes, nice. Thanks a lot for the quick reply :)
And is there a way to cut out some of the steps while keeping the others?
So in the following the marked (->) steps would be taken out, could I do it with this script?
15
1440 (1 day)
-> 1440 * Starting Ease
1440 * Starting Ease^2
-> 1440 * Starting Ease^3
Graduating Interval = 1440 * Starting Ease^3
eventually becoming this:
15
1440 (1 day)
1440 * Starting Ease^2
Graduating Interval = 1440 * Starting Ease^3
regards 😄
you could do something like:
l = int(1440*ease**(i+1))
instead of
l = int(1440*ease**i)
Thank you! 👍
Also helped me a lot to understand the code better! :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You'd have to change the 'for i in range(10):" to a different number in the range() function and possibly change the maximum length of a learning step (currently set to 28800).
The number in the range() function defines the maximum learning steps that are generated. Learning steps keep being generated until you either reach that number, or the learning step goes beyond the maximum length.