Package opennlp.tools.doccat
Class NGramFeatureGenerator
- java.lang.Object
- 
- opennlp.tools.doccat.NGramFeatureGenerator
 
- 
- All Implemented Interfaces:
- FeatureGenerator
 
 public class NGramFeatureGenerator extends Object implements FeatureGenerator Generates ngram features for a document. n-gramFeatureGenerator
- 
- 
Constructor SummaryConstructors Constructor Description NGramFeatureGenerator()Default constructor for Bi gramsNGramFeatureGenerator(int minGram, int maxGram)Constructor for ngrams.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<String>extractFeatures(String[] text, Map<String,Object> extraInfo)Extract ngram features from given text fragments
 
- 
- 
- 
Constructor Detail- 
NGramFeatureGeneratorpublic NGramFeatureGenerator(int minGram, int maxGram) throws InvalidFormatExceptionConstructor for ngrams.- Parameters:
- minGram- minGram value - which means minimum words in ngram features
- maxGram- maxGram value - which means maximum words in ngram features
- Throws:
- InvalidFormatException
 
 - 
NGramFeatureGeneratorpublic NGramFeatureGenerator() throws InvalidFormatExceptionDefault constructor for Bi grams- Throws:
- InvalidFormatException
 
 
- 
 - 
Method Detail- 
extractFeaturespublic Collection<String> extractFeatures(String[] text, Map<String,Object> extraInfo) Extract ngram features from given text fragments- Specified by:
- extractFeaturesin interface- FeatureGenerator
- Parameters:
- text- the text fragments to extract features from
- extraInfo- optional extra information
- Returns:
- a collection of n gram features
 
 
- 
 
-