fsrs

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2022 License: MIT Imports: 4 Imported by: 6

README

go-fsrs

Go Reference Go Report Card

Go module implements Free Spaced Repetition Scheduler algorithm

Usage

I'm developing a more useful module, the current module is only the algorithm implementation.

Please see GoDoc for documents.

The Module Is in Very Early Stage, and It's Subject to Change

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CardData

type CardData struct {
	CardDataItem

	History []*CardDataItem
}

type CardDataItem

type CardDataItem struct {
	Due            time.Time
	Interval       uint64 // 上次复习间隔(单位为天)
	Difficulty     float64
	Stability      float64
	Retrievability float64
	LastGrade      Grade // 上次得分
	Review         time.Time
	Reps           uint64
	Lapses         uint64
}

func (*CardDataItem) Copy

func (item *CardDataItem) Copy() CardDataItem

type GlobalData

type GlobalData struct {
	DifficultyDecay    float64          `json:"difficultyDecay"`
	StabilityDecay     float64          `json:"stabilityDecay"`
	IncreaseFactor     float64          `json:"increaseFactor"`
	RequestRetention   float64          `json:"requestRetention"`
	TotalCase          uint64           `json:"totalCase"`
	TotalDiff          float64          `json:"totalDiff"`
	TotalReview        uint64           `json:"totalReview"`
	DefaultDifficulty  float64          `json:"defaultDifficulty"`
	DefaultStability   float64          `json:"defaultStability"`
	StabilityDataArray []*StabilityData `json:"stabilityDataArray"`
}

func DefaultGlobalData

func DefaultGlobalData() GlobalData

DefaultGlobalData returns the default values of GlobalData

func (*GlobalData) Learn

func (globalData *GlobalData) Learn(cardData *CardData, grade Grade)

type Grade

type Grade int8
const (
	GradeForgetting Grade = iota
	GradeRemembered
	GradeEasy

	GradeNewCard Grade = -1
)

type StabilityData

type StabilityData struct {
	Interval       uint64
	Retrievability uint64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL