Class BagOfWordsFeatureGenerator
java.lang.Object
opennlp.tools.doccat.BagOfWordsFeatureGenerator
- All Implemented Interfaces:
FeatureGenerator
Generates a feature for each word in a document.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a defaultBagOfWordsFeatureGeneratorinstance.BagOfWordsFeatureGenerator(boolean useOnlyAllLetterTokens) Instantiates aBagOfWordsFeatureGeneratorinstance. -
Method Summary
Modifier and TypeMethodDescriptionextractFeatures(String[] text, Map<String, Object> extraInformation) Extracts features from giventextfragments.
-
Field Details
-
useOnlyAllLetterTokens
private final boolean useOnlyAllLetterTokens
-
-
Constructor Details
-
BagOfWordsFeatureGenerator
public BagOfWordsFeatureGenerator()Instantiates a defaultBagOfWordsFeatureGeneratorinstance. -
BagOfWordsFeatureGenerator
BagOfWordsFeatureGenerator(boolean useOnlyAllLetterTokens) Instantiates aBagOfWordsFeatureGeneratorinstance.- Parameters:
useOnlyAllLetterTokens- Whether to use only all-letter tokens, or not.
-
-
Method Details
-
extractFeatures
Description copied from interface:FeatureGeneratorExtracts features from giventextfragments.- Specified by:
extractFeaturesin interfaceFeatureGenerator- Parameters:
text- The text fragments to extract features fromextraInformation- Optional extra information to be used by theFeatureGenerator.- Returns:
- A collection of features.
-