Package opennlp.tools.doccat

# Class NGramFeatureGenerator

java.lang.Object
opennlp.tools.doccat.NGramFeatureGenerator

All Implemented Interfaces:
  `opennlp.tools.doccat.FeatureGenerator`

public class NGramFeatureGenerator extends Object implements opennlp.tools.doccat.FeatureGenerator
Generates ngram features for a document.

See Also:
  - `FeatureGenerator`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NGramFeatureGenerator()`
  Instantiates an `NGramFeatureGenerator` instance with a Bi grams config.
  `NGramFeatureGenerator(int minGram, int maxGram)`
  Instantiates an `NGramFeatureGenerator` instance with configurable ngram parameters.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Collection<String>`
  `extractFeatures(String[] text, Map<String,Object> extraInfo)`

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

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

- ## Constructor Details

  - ### NGramFeatureGenerator

    public NGramFeatureGenerator(int minGram, int maxGram) throws opennlp.tools.util.InvalidFormatException
    Instantiates an `NGramFeatureGenerator` instance with configurable ngram parameters.
    Parameters:
      `minGram` - The minimum words in ngram features.
      `maxGram` - The maximum words in ngram features.
    Throws:
      `opennlp.tools.util.InvalidFormatException` - Thrown if parameter values are invalid or inconsistent.

  - ### NGramFeatureGenerator

    public NGramFeatureGenerator() throws opennlp.tools.util.InvalidFormatException
    Instantiates an `NGramFeatureGenerator` instance with a Bi grams config.
    Throws:
      `opennlp.tools.util.InvalidFormatException` - Thrown if parameter values are invalid or inconsistent.

- ## Method Details

  - ### extractFeatures

    public Collection<String> extractFeatures(String[] text, Map<String,Object> extraInfo)
    Specified by:
      `extractFeatures` in interface `opennlp.tools.doccat.FeatureGenerator`