memcurve

package
v0.0.0-...-84fbbad Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package memcurve provides data models of the memory curve.

This file was generated by setup_project.sh script.

Index

Constants

View Source
const (
	ConfidenceCertain = 1   // 牢记
	ConfidenceHigh    = 0.8 // 清晰 学习者非常确定记得知识
	ConfidenceMedium  = 0.5 // 熟悉 学习者有一定的把握记得知识
	ConfidenceLow     = 0.3 // 模糊 学习者对知识点的记忆不太确定
	ConfidenceNone    = 0.1 // 陌生 学习者几乎完全遗忘了知识

	// ReasonableConfidence 定义了合理的置信度阈值,当用户置信度高于该值时,表示记忆状态良好
	ReasonableConfidence = 0.6
)

Variables

View Source
var DefaultIntervals = []time.Duration{
	20 * time.Minute,
	40 * time.Minute,
	540 * time.Minute,
	24 * time.Hour,
	2 * 24 * time.Hour,
	4 * 24 * time.Hour,
	7 * 24 * time.Hour,
	14 * 24 * time.Hour,
	28 * 24 * time.Hour,
}

DefaultIntervals 默认复习间隔时间,可以作为 NewReviewCalculator 函数的参数,或者可以直接使用

Functions

This section is empty.

Types

type ReviewCalculator

type ReviewCalculator struct {
	ReviewLevel int // 每个知识点的当前复习级别
	// contains filtered or unexported fields
}

ReviewCalculator 结构体它集成了复习时间的计算,考虑了置信度和用户参数

func NewReviewCalculator

func NewReviewCalculator(intervals []time.Duration, factors UserFactors) *ReviewCalculator

NewReviewCalculator 创建一个新的ReviewCalculator实例

func (*ReviewCalculator) CalculateNextReview

func (calc *ReviewCalculator) CalculateNextReview(data *ReviewData, newConfidence float64) (newReviewTime time.Time, newReviewLevel int)

CalculateNextReview 根据上次复习时间、复习次数和置信度计算下一次复习的时间 现在返回新的复习级别并适配调整间隔的逻辑

func (*ReviewCalculator) CalculateReviewLevel

func (calc *ReviewCalculator) CalculateReviewLevel(data *ReviewData, newConfidence float64) int

CalculateReviewLevel 根据上次一复习级别和置信度,计算下次的合理复习级别,

func (*ReviewCalculator) MaxReviewLevel

func (calc *ReviewCalculator) MaxReviewLevel() int

MaxReviewLevel 最高的 Review 级别,-1 表示无配置

func (*ReviewCalculator) ReviewIntervalOf

func (calc *ReviewCalculator) ReviewIntervalOf(level int) time.Duration

ReviewIntervalOf 获取复习间隔,防止索引超出范围

type ReviewData

type ReviewData struct {
	ReviewRecords []time.Time // 复习记录
	ReviewLevel   int         // 每个知识点的当前复习级别
}

ReviewData 包含复习记录和用户因素

type UserFactors

type UserFactors struct {
	// ForgettingSpeed 表示遗忘速度
	// 1 表示正常速度,不会增加或减少 interval
	// 最少是 0.2 (表示遗忘的很慢,可以有 5 倍的 interval)
	// 最多是 5 (表示遗忘的很快)
	ForgettingSpeed float64
}

UserFactors 表示影响个体遗忘速率的参数

Jump to

Keyboard shortcuts

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