0.1.2 • Published 5 years ago
@byem.io/sm2 v0.1.2
Implementation of SuperMemo 2 algorithm
Check this article for detail: https://www.supermemo.com/english/ol/sm2.htm
Install
npm i @byem.io/sm2
Usage
import { ScheduleTrainer, Input } from './index';
const input: Input = {
currentRepetition: 0, // the current repetition counter
lastEasinessFactor: 2.5, // the easiness factor (E-Factor) used in last calculation
lastInterval: 0, // the last interval amount
qualityAssessment: 4 // the quality of review [0-5] -> worst to best
};
new ScheduleTrainer().train(input)
.then(result => {
// result:
// {
// repetition: number; // the repetition counter (will be reseted in failures)
// interval: number; // the interval amount until next review
// easiness: number; // the easiness factor (E-Factor) that next be used in the next training
// repeat: boolean; // if is true the item must be reviewed until the quality assesment isn't not less than four
// }
})
.catch(console.error);