Skip to main content

Simple spaced repetition library

Project description

simple-spaced-repetition

Simple spaced repetition scheduler, based on the classic Anki algorithm and implemented in under 40 lines of code.

This scheduler is used at Python.cards.

!Test status Supported Versions

Installation

Install with pip:

pip install simple_spaced_repetition

Example usage

The Card class is what you should use:

>>> from simple_spaced_repetition import Card
>>> Card()
Card(status=learning, step=0, interval=None, ease=2.5)

Card has a single method options() which returns the 4 possible choices for answering a card:

>>> from simple_spaced_repetition import Card
>>> card = Card()
>>> card.options()
[('again', Card(status=learning, step=0, interval=0:01:00, ease=2.5)),
 ('hard', Card(status=learning, step=1, interval=0:06:00, ease=2.5)),
 ('good', Card(status=learning, step=1, interval=0:10:00, ease=2.5)),
 ('easy', Card(status=reviewing, step=0, interval=4 days, 0:00:00, ease=2.5))]

Next to each answer is a new Card object that represents the card after answering with that option.

The attribute interval holds the time that must pass before the card is due again:

>>> from simple_spaced_repetition import Card
>>> card = Card()
>>> for answer, new_card in card.options():
...     print(answer, new_card.interval)
again 0:01:00
hard 0:06:00
good 0:10:00
easy 4 days, 0:00:00

Run tests

Simply run:

python test_simple_spaced_repetition.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple_spaced_repetition-0.2.0.tar.gz (3.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page