From 8babacbeeef0648eded65bbfcc02cbc0d3d17d59 Mon Sep 17 00:00:00 2001 From: Jarrett Ye Date: Thu, 12 Sep 2024 14:08:31 +0800 Subject: [PATCH] Feat/get retrievability --- fsrs.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fsrs.go b/fsrs.go index 8ae0e37..bad4760 100644 --- a/fsrs.go +++ b/fsrs.go @@ -19,3 +19,13 @@ func (f *FSRS) Repeat(card Card, now time.Time) RecordLog { func (f *FSRS) Next(card Card, now time.Time, grade Rating) SchedulingInfo { return f.scheduler(card, now).Review(grade) } + +func (f *FSRS) GetRetrievability(card Card, now time.Time) float64 { + if card.State == New { + return 0 + } else { + elapsedDays := now.Sub(card.LastReview).Hours() / 24 + retrievability := f.Parameters.forgettingCurve(elapsedDays, card.Stability) + return retrievability + } +}