DefaultLanguageDetectorContextGenerator (Apache OpenNLP Tools 2.5.9 API)
Description: declaration: package: opennlp.tools.langdetect, class: DefaultLanguageDetectorContextGenerator

# Class DefaultLanguageDetectorContextGenerator

java.lang.Object
opennlp.tools.langdetect.DefaultLanguageDetectorContextGenerator

All Implemented Interfaces:
  `Serializable, LanguageDetectorContextGenerator`

public class DefaultLanguageDetectorContextGenerator extends Object implements LanguageDetectorContextGenerator
A context generator for `language detector`.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultLanguageDetectorContextGenerator(int minLength, int maxLength, CharSequenceNormalizer... normalizers)`
  Creates a customizable `DefaultLanguageDetectorContextGenerator` that computes ngrams from text.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `<T extends CharSequence>
  T[]`
  `getContext(CharSequence document)`
  Retrieves the contexts for a `document` using character ngrams.

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### DefaultLanguageDetectorContextGenerator

    public DefaultLanguageDetectorContextGenerator(int minLength, int maxLength, CharSequenceNormalizer... normalizers)
    Creates a customizable `DefaultLanguageDetectorContextGenerator` that computes ngrams from text.
    Parameters:
      `minLength` - The min number of ngrams characters. Must be greater than `0`.
      `maxLength` - The max number of ngrams characters. Must be greater than `0` and must be greater than `minLength`.
      `normalizers` - Zero or more normalizers to be applied in to the text before extracting ngrams.

- ## Method Details

  - ### getContext

    public <T extends CharSequence> T[] getContext(CharSequence document)
    Description copied from interface: `LanguageDetectorContextGenerator`
    Retrieves the contexts for a `document` using character ngrams.
    Specified by:
      `getContext` in interface `LanguageDetectorContextGenerator`
    Parameters:
      `document` - The textual input used to extract context from.
    Returns:
      An array of contexts on which a model basis its decisions.