Options
All
  • Public
  • Public/Protected
  • All
Menu

An index of n-gram frequencies

Hierarchy

Index

Constructors

constructor

Methods

increment

  • increment(ngram: Ngram, value?: number): void
  • Increments the n-gram frequency. This will increment all of the important keys in the n-gram such as the words in question, lemma, etc.

    Parameters

    • ngram: Ngram

      the n-gram index to add

    • Default value value: number = 1

    Returns void

Protected incrementIndex

  • incrementIndex(key: string, value?: number): void
  • Adds a number to the key's value. If no number is given the default amount will be added to the value.

    Parameters

    • key: string
    • Default value value: number = 1

      optional value to add

    Returns void

read

  • read(ngram: Ngram | string): number
  • Reads a value from the index

    Parameters

    • ngram: Ngram | string

      the n-gram index to read. This may be a specific key, or the ngram object to read the default key.

    Returns number

Protected readIndex

  • readIndex(key: string): number
  • Reads a value from the index. If the key does not exist the result will be 0.

    Parameters

    • key: string

    Returns number

write

  • write(ngram: Ngram, value: number): void
  • Writes a value to the index

    deprecated

    Parameters

    • ngram: Ngram

      the n-gram index to write

    • value: number

    Returns void

Protected writeIndex

  • writeIndex(key: string, value: number): void
  • Manually writes a value to the index

    deprecated

    use incrementIndex instead.

    Parameters

    • key: string
    • value: number

    Returns void

Generated using TypeDoc