Coder Social home page Coder Social logo

py-fsrs's Introduction

About The Project

PyPi Code style: black

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 datetime import datetime, UTC
from fsrs import *
f = FSRS()
card = Card()
# (py-fsrs cards use UTC)
now = datetime(2022, 11, 29, 12, 30, 0, 0, tzinfo=UTC) 
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.

py-fsrs's People

Contributors

ishiko732 avatar joshdavham avatar l-m-sherlock avatar oflg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.