Package opennlp.tools.doccat
Class NGramFeatureGenerator
java.lang.Object
opennlp.tools.doccat.NGramFeatureGenerator
- All Implemented Interfaces:
FeatureGenerator
Generates ngram features for a document.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionInstantiates anNGramFeatureGeneratorinstance with a Bi grams config.NGramFeatureGenerator(int minGram, int maxGram) Instantiates anNGramFeatureGeneratorinstance with configurable ngram parameters. -
Method Summary
Modifier and TypeMethodDescriptionextractFeatures(String[] text, Map<String, Object> extraInfo) Extracts features from giventextfragments.
-
Constructor Details
-
NGramFeatureGenerator
Instantiates anNGramFeatureGeneratorinstance with configurable ngram parameters.- Parameters:
minGram- The minimum words in ngram features.maxGram- The maximum words in ngram features.- Throws:
InvalidFormatException- Thrown if parameter values are invalid or inconsistent.
-
NGramFeatureGenerator
Instantiates anNGramFeatureGeneratorinstance with a Bi grams config.- Throws:
InvalidFormatException- Thrown if parameter values are invalid or inconsistent.
-
-
Method Details
-
extractFeatures
Description copied from interface:FeatureGeneratorExtracts features from giventextfragments.- Specified by:
extractFeaturesin interfaceFeatureGenerator- Parameters:
text- The text fragments to extract features fromextraInfo- Optional extra information to be used by theFeatureGenerator.- Returns:
- A collection of features.
-