Options
All
  • Public
  • Public/Protected
  • All
Menu

Module algorithm

Index

Functions

deduplicate

  • Deduplicate a set of flashcards. This method finds groups of cards with similar fronts, and for each such group, recommends one canonical flashcard that includes the information from all cards in the group.

    This allows the user to learn more efficiently using the set of canonical cards instead. This set may have fewer cards than the original set, but it contains the same information relevant to learning.

    Identical fronts are always similar, but fronts can be similar for other reasons as well.

    Parameters

    • originalCards: Set<Flashcard>

      a set of flashcards

    Returns Map<Flashcard, Set<Flashcard>>

    a map in which each key is a canonical card mapping to a nonempty set of similar-front cards. The sets of similar-front cards are disjoint, and their union is originalCards.

getBucketRange

  • getBucketRange(buckets: Set<Flashcard>[]): number[]
  • Find a minimal range of bucket numbers covering a list of learning buckets.

    Parameters

    • buckets: Set<Flashcard>[]

      a list of disjoint sets representing learning buckets, where buckets[i] is the set of cards in the ith bucket, for all i that are valid indexes of the list.

    Returns number[]

    a pair of integers [low, high], 0 <= low <= high, such that every card in buckets has a bucket number in the range [low...high] inclusive, and high - low is as small as possible

practice

  • Generate a sequence of flashcards for practice on a particular day.

    Parameters

    • day: number

      day of the learning process. Must be >= 1.

    • buckets: Set<Flashcard>[]

      a list of disjoint sets representing learning buckets, where buckets[i] is the set of cards in the ith bucket for all 0 <= i <= retiredBucket

    • retiredBucket: number

      number of retired bucket. Must be >= 0.

    Returns Flashcard[]

    a sequence of flashcards such that a card appears in the sequence if and only if its bucket number is some i < retiredBucket such that day is divisible by 2^i

toBucketSets

  • Reorganize learning buckets from a map representation to a list-of-sets representation.

    Parameters

    • bucketNumbers: Map<Flashcard, number>
      * correction from the starting code,
        which reads "nonnegative"

      maps each flashcard to a bucket* number

    Returns Set<Flashcard>[]

    a list of disjoint sets whose union is the set of cards in bucketNumbers, and where list[i] is the set of cards that bucketNumbers maps to i, for all i in [0, list.length).

update

  • Update step for the Modified-Leitner algorithm.

    Parameters

    • card: Flashcard

      a flashcard the user just saw

    • answer: AnswerDifficulty

      the user's answer to the flashcard

    • bucketMap: Map<Flashcard, number>

      represents learning buckets before the flashcard was seen. Maps each flashcard to a bucket number in the range [0...retiredBucket] inclusive. Mutated by this method to put card in the appropriate bucket as determined by the Modified-Leitner algorithm.

    • retiredBucket: number

      number of retired bucket. Must be >= 0.

    Returns void

Generated using TypeDoc