-
-
Save eshapard/960f2508c2096ff663af3b6ebc925f16 to your computer and use it in GitHub Desktop.
# 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) |
such an interesting thread here. So it work on the latest version of Anki?
Yes
In the article it says "Maybe I’ll add an option to select the number of learning steps you want to use." at the very end of it.
Is there a way to tweak the script that way?
I tried playing around with the 28.800 but it didn't change the amount of steps :/
(sry for noob question 😅)
In the article it says "Maybe I’ll add an option to select the number of learning steps you want to use." at the very end of it.
Is there a way to tweak the script that way?
I tried playing around with the 28.800 but it didn't change the amount of steps :/
(sry for noob question 😅)
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.
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! :)
@woolfog Not sure if anyone here is still active, but I get an error with your code on Anki startup.