Documentation ¶
Index ¶
- Variables
- type Bayesian
- type Card
- type Completion
- type Config
- type ConfigNames
- type ConfigSet
- type Difficulties
- type EvaluationView
- type Filter
- func FilterAND(filters ...Filter) Filter
- func FilterAfterDate(date time.Time) Filter
- func FilterAfterDuration(duration time.Duration) Filter
- func FilterBeforeDate(date time.Time) Filter
- func FilterBeforeDuration(duration time.Duration) Filter
- func FilterOR(filters ...Filter) Filter
- func FilterPaths(paths ...string) Filter
- func FilterPathsExact(paths ...string) Filter
- func FilterTags(tags ...string) Filter
- type ProbabilityNode
- type Random
- type Set
- type Store
- type Unseen
- type View
Constants ¶
This section is empty.
Variables ¶
var DefaultSetAll = ConfigSet{
Name: "All",
Description: "This set contains all cards added to the program.",
Color: "#d7816a",
Background: "linear-gradient(315deg, #bd4f6c 0%, #d7816a 74%)",
}
DefaultSetAll is the config for the default set, All, which contains all
var DefaultViews = map[string]View{ "random": NewViewRandom(time.Now().Unix()), "unseen": NewViewUnseen(time.Now().Unix()), "difficulties": NewViewDifficulties(time.Now().Unix()), "bayesian": NewViewBayesian(time.Now().Unix()), }
DefaultViews is a map containing the default Views used by the program.
Functions ¶
This section is empty.
Types ¶
type Bayesian ¶
type Bayesian struct {
// contains filtered or unexported fields
}
Bayesian uses Bayesian inference in order to try and select the card you're most likely to get wrong. The method comes from Probabilistic Programming and Bayesian Methods for Hackers:
https://nbviewer.jupyter.org/github/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/blob/master/Chapter6_Priorities/Ch6_Priors_PyMC2.ipynb
The basic idea is to turn the card picking problem into a multi-armed bandit problem. Each path then becomes a "bandit" and has an associated probability distribution based on the questions answered correctly and the questions answered incorrectly.
func NewViewBayesian ¶
NewViewBayesian returns a new view based on Bayesian inference.
type Card ¶
type Card struct { ID string Path string Date time.Time Tags []string Notes string CompletionsPerfect []Completion CompletionsMinor []Completion CompletionsMajor []Completion QuestionPath string AnswerPath string }
Card is the basic unit of the program. It's an abstraction over an Albatross entry and represents a question-answer pair.
func (*Card) AnswerImage ¶
AnswerImage returns the data URI of the answer image, created by converting the file to base64.
func (*Card) Content ¶
Content returns how the card is represented as an entry. Think of it like the opposite of cardFromEntry.
func (*Card) PathParent ¶
PathParent returns the path to the parent of the card. You could think of this as the card category.
func (*Card) QuestionImage ¶
QuestionImage returns the data URI of the question image, created by converting the file to base64.
func (*Card) TotalCompletions ¶
TotalCompletions returns the total number of completions for this card.
type Completion ¶
Completion is a mark specifying that a card was completed at a certain date in a certain amount of time.
type Config ¶
type Config struct { Names ConfigNames Sets map[string]ConfigSet Store *albatross.Config }
Config represents the top-level configuration for the program.
func LoadConfig ¶
LoadConfig returns the Config located at the given path. If no path is specified, the default ".config/sergeant/config.yaml" is used.
type ConfigNames ¶
ConfigNames lets you give friendlier names to paths to specific questions.
type ConfigSet ¶
type ConfigSet struct { Name string `yaml:"name"` Description string `yaml:"description"` PathsOr []string `yaml:"paths"` TagsOr []string `yaml:"tags"` PathsAnd []string `yaml:"paths-and"` TagsAnd []string `yaml:"tags-and"` BeforeDuration time.Duration AfterDuration time.Duration BeforeDate time.Time AfterDate time.Time Color string Background string }
ConfigSet represents the definition of a set, as specified in the config file.
type Difficulties ¶
type Difficulties struct {
// contains filtered or unexported fields
}
Difficulties selects cards that it predicts you are most likely to get wrong. This is done through a combination of the overall probability for a certain category (like "futher-maths/section-complex-numbers" for example) and a specific probablility (like "further-maths/section-complex-numbers/chapter-2-argand-diagrams"). The "strength" of the sample size is computed in order to work out how much weight should be given to the sample instead of the general probability. For a visual and interactive explanation, see https://www.desmos.com/calculator/fouzmkkbo8.
func NewViewDifficulties ¶
func NewViewDifficulties(seed int64) *Difficulties
NewViewDifficulties returns a new Difficulties view with the given seed.
func (*Difficulties) BuildTrie ¶
func (view *Difficulties) BuildTrie(set *Set) (pathTrie *trie.PathTrie, paths []string)
BuildTrie creates a path trie that contains difficulty information. A trie is a "prefix tree", where each all elements that share a common prefix are grouped under the same parent. This uses a question's path to create a hierarchy of all the possible questions. It will also return a sorted slice of all paths present.
func (*Difficulties) Next ¶
func (view *Difficulties) Next(set *Set) *Card
Next looks at all previous cards and decides what card to show next.
type EvaluationView ¶
EvaluationView is a View which assigns a numerical score to each node.
type Filter ¶
Filter represents a way of allowing or disallowing a card.
func FilterAND ¶
FilterAND combines multiple filters together and they all have to match an entry for it to be allowed.
func FilterAfterDate ¶
FilterAfterDate returns a filter that only allows cards that were created before a certain date.
func FilterAfterDuration ¶
FilterAfterDuration returns a filter that only allows cards created a certain amount of time ago. For example
FilterAfterDuration(30 * 24 * time.Hour)
only lets cards created less than 30 days ago be used.
func FilterBeforeDate ¶
FilterBeforeDate returns a filter that only allows cards that were created before a certain date.
func FilterBeforeDuration ¶
FilterBeforeDuration returns a filter that only allows cards created a certain amount of time ago. For example
FilterBeforeDuration(10 * 24 * time.Hour)
only lets cards created more than 10 days ago be used.
func FilterOR ¶
FilterOR combines multiple filters together and if any of them match the given entry, it will be allowed.
func FilterPaths ¶
FilterPaths returns a filter that only allows cards who's path begins with the paths specified. This is an OR operation -- if any of the paths given match, then the card is allowed.
func FilterPathsExact ¶
FilterPathsExact returns a filter that only allows cards who's path is equal to one of the paths specified. This is an OR operation -- if any of the paths given match the card, then the card is allowed.
func FilterTags ¶
FilterTags returns a filter that only allows cards who contain the given tags. This is an AND operations -- all of the tags have to match for the card to be allowed.
type ProbabilityNode ¶
ProbabilityNode represents a node in the probability tree.
type Random ¶
type Random struct {
// contains filtered or unexported fields
}
Random selects a random card from all possible cards.
func NewViewRandom ¶
NewViewRandom returns a new Random view with the given seed.
type Store ¶
type Store struct { Config Config Sets map[string]ConfigSet // contains filtered or unexported fields }
Store is an abstraction over an *albatross.Store that allows for updating cards.
func (*Store) AddCompletion ¶
func (store *Store) AddCompletion(path string, completionType string, completion Completion) error
AddCompletion adds a completion to an entry in the store.
func (*Store) Set ¶
Set returns the cards present in the set specified. It knows what cards you want in the set from the .Sets configuration. It returns a Set, followed by a map of warnings (paths -> parse errors) and an overall error if there was one.
func (*Store) SetFromConfig ¶
SetFromConfig returns the cards present in the set specified by the config. It returns a Set, followed by a map of warnings (paths -> parse errors) and an overall error if there was one.
type Unseen ¶
type Unseen struct {
// contains filtered or unexported fields
}
Unseen selects cards that have yet to come up.
func NewViewUnseen ¶
NewViewUnseen returns a new Unseen view with the given seed.