Free Spaced Repetition Scheduler
Project description
Py-FSRS
Py-FSRS is a python package that allows developers to easily create their own spaced repetition system using the Free Spaced Repetition Scheduler algorithm.
Installation
You can install the fsrs
python package from PyPI using pip:
pip install fsrs
Quickstart
Import and initialize the FSRS scheduler
from fsrs import *
f = FSRS()
Create a new Card object
# all new cards are 'due' immediately upon creation
card = Card()
Choose a rating and review the card
# you can choose one of the four possible 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
"""
rating = Rating.Good
card, review_log = f.review_card(card, rating)
See when the card is due next
from datetime import datetime, timezone
due = card.due
# how much time between when the card is due and now
time_delta = due - datetime.now(timezone.utc)
print(f"Card due: at {repr(due)}")
print(f"Card due in {time_delta.seconds} seconds")
"""
> Card due: at datetime.datetime(2024, 7, 12, 18, 16, 4, 429428, tzinfo=datetime.timezone.utc)
> Card due in: 599 seconds
"""
Reference
Card objects have one of four possible 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
There are four possible ratings when reviewing a card object:
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 review log for a given rating
review_log = scheduling_cards[card_rating].review_log
Get the schdeduled days after rating a card
scheduled_days = card_object.scheduled_days
Contribute
Checkout CONTRIBUTING to help improve Py-FSRS!
License
Distributed under the MIT License. See LICENSE for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.