SymSpellConfig.Builder (Apache OpenNLP :: Ext :: SpellChecker 3.0.0-M4 API)
Description: declaration: package: opennlp.spellcheck.symspell, class: SymSpellConfig, class: Builder

Package opennlp.spellcheck.symspell

# Class SymSpellConfig.Builder

java.lang.Object
opennlp.spellcheck.symspell.SymSpellConfig.Builder

Enclosing class:
  `SymSpellConfig`

public static final class SymSpellConfig.Builder extends Object
Mutable builder for `SymSpellConfig`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `SymSpellConfig`
  `build()`
  `SymSpellConfig.Builder`
  `corpusWordCount(long value)`
  Pins the corpus normalization constant N used by the Naive-Bayes word combine/split scoring in `SymSpell.lookupCompound(String, int)`.
  `SymSpellConfig.Builder`
  `countThreshold(long value)`
  `SymSpellConfig.Builder`
  `editDistance(EditDistance value)`
  `SymSpellConfig.Builder`
  `maxDictionaryEditDistance(int value)`
  `SymSpellConfig.Builder`
  `prefixLength(int value)`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### maxDictionaryEditDistance

    public SymSpellConfig.Builder maxDictionaryEditDistance(int value)
    Parameters:
      `value` - largest precomputed dictionary edit distance; must be `>= 0`
    Returns:
      this builder
    Throws:
      `IllegalArgumentException` - if `value` is negative

  - ### prefixLength

    public SymSpellConfig.Builder prefixLength(int value)
    Parameters:
      `value` - number of leading symbols used for delete generation; must be `>= 1` and `> maxDictionaryEditDistance`
    Returns:
      this builder
    Throws:
      `IllegalArgumentException` - if `value` is `< 1` (the cross-check against `maxDictionaryEditDistance` is enforced by `build()`)

  - ### countThreshold

    public SymSpellConfig.Builder countThreshold(long value)
    Parameters:
      `value` - minimum corpus count for a term to be indexed; must be `>= 1`
    Returns:
      this builder
    Throws:
      `IllegalArgumentException` - if `value` is `< 1`

  - ### editDistance

    public SymSpellConfig.Builder editDistance(EditDistance value)
    Parameters:
      `value` - verification metric to inject; must not be `null`
    Returns:
      this builder

  - ### corpusWordCount

    public SymSpellConfig.Builder corpusWordCount(long value)
    Pins the corpus normalization constant N used by the Naive-Bayes word combine/split scoring in `SymSpell.lookupCompound(String, int)`.
    Parameters:
      `value` - the corpus word count to pin, or `SymSpellConfig.DERIVE_CORPUS_WORD_COUNT` to derive N from the loaded dictionary's summed counts; must be `>= 0`
    Returns:
      this builder
    Throws:
      `IllegalArgumentException` - if `value` is negative

  - ### build

    public SymSpellConfig build()
    Returns:
      the immutable configuration
    Throws:
      `IllegalArgumentException` - if `prefixLength` is not strictly greater than `maxDictionaryEditDistance`