Giter Club home page Giter Club logo

femto-fsrs's Introduction

Femto-FSRS

A zero dependency implementation of the FSRS 4.5 spaced repetition algorithm.

I am building this library as a replacement to SM-2 in KoalaSRS.

Demo

I made an HTML pen-and-paper demo here. You can store facts on paper and use Femto-FSRS for scheduling, just like Piotr Wozniak did in the 80s.

Features

  • Zero dependencies
  • Well annotated source code that (mostly) follows the paper.
  • Sensible defaults.

Usage

import { Grade, createDeck } from "femto-fsrs";

// === Create a new deck
const { newCard, gradeCard } = createDeck();

// === Initiate a new card with an initial grade of "GOOD":
const initialGrade = Grade.GOOD;
const myCard = newCard(initialGrade);

// === Grade the card as "easy" two days later.
//     Returns a new card that replaces the old one.
const daysSinceReview = 2;
const nextCard = gradeCard(myCard, daysSinceReview, Grade.EASY);
// The "I" attribute represents "I" like in the FSRS paper.
// It is the next review date at which the probability
// of success is 90% (assuming you used default parameters).
const nextReview = nextCard.I.toFixed(2);
// Print results:
console.log(`Card will be due for review in ${nextReview} day(s)`);

Result:

Card will be due for review in 16.63 day(s)

Installation

npm install femto-fsrs

Not Included

This is supposed to be a minimalistic library that can be used as a starting point for FSRS-enhanced apps. If you need a more full-featured offering with features like logs (so you can optimize your w param) or revert, etc.., check out ts-fsrs.

Tests

npm run test

femto-fsrs's People

Contributors

rickcarlino avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  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.