Project

fsrs

0.0
The project is in a healthy, maintained state
A ruby implementation of the Open Spaced Repetition's Free Spaced Repetition Scheduler.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Ruby Gem Version

About The Project

rb-fsrs is a Ruby Gem implements Free Spaced Repetition Scheduler algorithm. It helps developers apply FSRS in their flashcard apps.

Getting Started

gem install fsrs

or

bundle add fsrs

Usage

Create a card and review it at a given time:

require 'fsrs'

scheduler = Fsrs::Scheduler.new
card = Fsrs::Card.new
now = DateTime.now.utc
scheduling_cards = scheduler.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

Acknowledgements

This library was ported from py-fsrs to Ruby. Much refactoring to be done, but the core logic is the same.

License

Distributed under the MIT License. See LICENSE for more information.