py-fsrs
py-fsrs copied to clipboard
Python Package for FSRS
About The Project
Py-fsrs is a Python Package implements Free Spaced Repetition Scheduler algorithm. It helps developers apply FSRS in their flashcard apps.
Getting Started
pip install fsrs
Usage
Create a card and review it at a given time:
from fsrs import *
f = FSRS()
card = Card()
now = datetime(2022, 11, 29, 12, 30, 0, 0)
scheduling_cards = f.repeat(card, now)
There are four ratings:
Rating.Again # forget; incorrect response
Rating.Hard # recall; correct response recalled with serious difficulty
Rating.Good # recall; correct response after a hesitation
Rating.Easy # recall; perfect response
Get the new state of card for each rating:
scheduling_cards[Rating.Again].card
scheduling_cards[Rating.Hard].card
scheduling_cards[Rating.Good].card
scheduling_cards[Rating.Easy].card
Get the scheduled days for each rating:
card_again.scheduled_days
card_hard.scheduled_days
card_good.scheduled_days
card_easy.scheduled_days
Update the card after rating Good
:
card = scheduling_cards[Rating.Good].card
Get the review log after rating Good
:
review_log = scheduling_cards[Rating.Good].review_log
Get the due date for card:
due = card.due
There are four states:
State.New # Never been studied
State.Learning # Been studied for the first time recently
State.Review # Graduate from learning state
State.Relearning # Forgotten in review state
License
Distributed under the MIT License. See LICENSE
for more information.