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
ConstructorDescriptionInstantiates anNGramFeatureGenerator
instance with a Bi grams config.NGramFeatureGenerator
(int minGram, int maxGram) Instantiates anNGramFeatureGenerator
instance with configurable ngram parameters. -
Method Summary
Modifier and TypeMethodDescriptionextractFeatures
(String[] text, Map<String, Object> extraInfo) Extracts features from giventext
fragments.
-
Constructor Details
-
NGramFeatureGenerator
Instantiates anNGramFeatureGenerator
instance 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 anNGramFeatureGenerator
instance with a Bi grams config.- Throws:
InvalidFormatException
- Thrown if parameter values are invalid or inconsistent.
-
-
Method Details
-
extractFeatures
Description copied from interface:FeatureGenerator
Extracts features from giventext
fragments.- Specified by:
extractFeatures
in interfaceFeatureGenerator
- Parameters:
text
- The text fragments to extract features fromextraInfo
- Optional extra information to be used by theFeatureGenerator
.- Returns:
- A collection of features.
-