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 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