supermemo

package
v0.0.0-...-3530f45 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2013 License: MIT Imports: 2 Imported by: 1

Documentation

Overview

package supermemo implements the supermemo SM-2 algorithm, described here, and documented in more detail at http://www.supermemo.com/english/ol/sm2.htm.

First, there are a few vocabulary items used by this algorithm that we should cover:

EF: Easiness Factor. Higher means easier. This represents the ease of memorizing a given item.

I(n): Interval, in days, between repetitions of an item. n represents the number of times the item has been seen.

q: The quality of a response, from 0-5, where:

5 - perfect response;
4 - correct response after a hesitation;
3 - correct response recalled with serious difficulty;
2 - incorrect response where the correct one seemed easy to recall;
1 - incorrect response, correct one remembered upon seeing answer;
0 - complete blackout.

With vocabulary out of the way, the algorithm itself is fairly straightforward:

1. Split the knowledge into the smallest possible items. Think flash cards.

2. With each item, associate an initial EF of 2.5.

3. Repeat items using the following intervals, expressed in days:

I(1)       := 1
I(2)       := 6
I(n | n>2) := I(n-1)*EF

4. After each response, assess the quality of the response (q) as described above in the Vocabulary section.

5. After each response, modify the EF by the formula:

EF':=EF+(0.1-(5-q)*(0.08+(5-q)*0.02))

6. If the most recent q > 3, reset n; that is, restart repetitions from I(0).

7. After all items are processed, repeat all items where q < 4, until all items have at least 4.

This algorithm is implemented in fact_metadata.go, on the FactMetadata type.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fact

type Fact struct {
	Question string
	Answer   string

	*FactMetadata
}
Example
type Question struct {
	q, a string
	f    *Fact
}

q1 := &Question{"Capital of Canada?", "Ottawa", NewFact()}
q1.f.Assess(5)                  // correct answer; immediate recall
fmt.Println(q1.f.UpForReview()) // false

q2 := &Question{"Capital of Ontario?", "Toronto", NewFact()}
q2.f.Assess(0)                  // incorrect answer; no idea whatsoever.
fmt.Println(q2.f.UpForReview()) // true
Output:

func LoadFact

func LoadFact(q, a string, ef float64, n, interval int, intervalFrom string) (*Fact, error)

func NewFact

func NewFact(q, a string) *Fact

func (*Fact) Dump

func (f *Fact) Dump() (q, a string, ef float64, n, interval int, intervalFrom string)

type FactMetadata

type FactMetadata struct {
	// contains filtered or unexported fields
}

type FactMetadata contains metadata associated to a conceptual knowledge item, with which the SM2 algorithm can work. Calling code will generally embed a FactMetadata in a type containing a Question and Answer.

func (*FactMetadata) Assess

func (f *FactMetadata) Assess(q int)

Assess updates the FactMetadata object with a new Interval and Easiness FactMetadataor based on the difficulty assessment provided by the user.

func (*FactMetadata) UpForReview

func (f *FactMetadata) UpForReview() bool

`interval` days after the date represented by `intervalFrom`, the fact is up for review. Are we at or past that date?

type FactSet

type FactSet []*Fact

func (FactSet) ForReview

func (s FactSet) ForReview() FactSet

Jump to

Keyboard shortcuts

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