Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly handle reviewing ahead #129

Open
st3v3nmw opened this issue Jun 6, 2021 · 1 comment
Open

Properly handle reviewing ahead #129

st3v3nmw opened this issue Jun 6, 2021 · 1 comment
Projects

Comments

@st3v3nmw
Copy link
Owner

@st3v3nmw st3v3nmw commented Jun 6, 2021

https://docs.ankiweb.net/filtered-decks.html#reviewing-ahead

@st3v3nmw st3v3nmw added this to To do (ordered by priority) in Roadmap Jun 7, 2021
@st3v3nmw st3v3nmw mentioned this issue Jun 13, 2021
16 tasks
@st3v3nmw st3v3nmw moved this from To do to In Progress in Roadmap Aug 28, 2021
@st3v3nmw
Copy link
Owner Author

@st3v3nmw st3v3nmw commented Aug 29, 2021

Anki algorithm (source):

def _earlyReviewIvl(self, card: Card, ease: int) -> int:
        assert card.odid and card.type == CARD_TYPE_REV
        assert card.factor
        assert ease > 1

        elapsed = card.ivl - (card.odue - self.today)
#// elapsed: number of days that have passed since you reviewed the card
#// card.ivl: card's given interval
#// card.odue: card's original due date
#// self.today: today date

        conf = self._revConf(card)

        easyBonus = 1
        # early 3/4 reviews shouldn't decrease previous interval
        minNewIvl = 1

        if ease == BUTTON_TWO:  #// if you press hard
            factor = conf.get("hardFactor", 1.2)
#// hardFactor: should 
            # hard cards shouldn't have their interval decreased by more than 50%
            # of the normal factor
            minNewIvl = factor / 2
        elif ease == BUTTON_THREE:  #// if you press good
            factor = card.factor / 1000
        else:  # ease == BUTTON_FOUR:  #// if you press easy
            factor = card.factor / 1000
            ease4 = conf["ease4"]
#// ease4: should be the ease bonus (review tab in deck options) not sure tho
            # 1.3 -> 1.15
            easyBonus = ease4 - (ease4 - 1) / 2

        ivl_1 = max(elapsed * factor, 1)
#// card.factor: if ease = 250%, card.factor = 2500
#// factor: if ease = 250%, factor = 2.5

        # cap interval decreases
        ivl_2 = max(card.ivl * minNewIvl, ivl_1) * easyBonus

        ivl_3 = self._constrainedIvl(ivl_2, conf, prev=0, fuzz=False)
#// self._constrainedIvl -> applies fuzz,checks for maximum interval cap,
#// checks for previous interval and does one more thing that i honestly don't understand :/
#// for review ahead, fuzz is false (no fuzz applies)
#// previous interval = 0, maximum is always the interval that this function gives it
#// so i'll just assume that it has no effect on the interval and just use this function in my example (:|)

        return ivl_3
#// returns new interval for the card

if you press hard:

card.ivl = 20 (days)
elapsed = 9 (days)

easyBonus = 1
minNewIvl = 0.55 (factor = conf.get("hardFactor", 1.2 | then minNewIvl = factor / 2) (my hard factor is 110% -> anki stores it as 1.10 => 1.10/2 = 0.55)
factor = 1.1

ivl_1 = 10
ivl_2 = 11
final interval on hard button = 11 (days)

if you press good:

elapsed = 9 (days)

easyBonus = 1
minNewIvl = 1
factor = 2.5

ivl_1 = 22.5
ivl_2 = 22.5
final interval on good button = 22 (days)

if you press easy:

card.ivl = 20 (days)
elapsed = 9 (days)

easyBonus = 1.15 (check out #NOTE)
minNewIvl = 1
factor = 2.5

ivl_1 = 22.5
ivl_2 = 25.8
final interval on easy button = 26 (days)

#NOTE -> how easyBonus was calculated:
ease4 = conf[“ease4”] -> this is the easy bonus that you set on deck options -> review tab | if it’s 130%, anki stores it as 1.3

easyBonus = ease4 - (ease4 - 1) / 2

so if ease4 = 1.3 -> easyBonus = 1.3 - (0.3)/2 => 1.3 - 0.15 = 1.15

@st3v3nmw st3v3nmw moved this from In Progress to To do in Roadmap Oct 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Roadmap
To do
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant