Package opennlp.tools.namefind
Class DefaultNameContextGenerator
java.lang.Object
opennlp.tools.namefind.DefaultNameContextGenerator
- All Implemented Interfaces:
- NameContextGenerator,- BeamSearchContextGenerator<String>
A 
NameContextGenerator implementation for determining contextual features
 for a tag-chunk style named-entity recognizer.- 
Constructor SummaryConstructorsConstructorDescriptionDefaultNameContextGenerator(AdaptiveFeatureGenerator... featureGenerators) Creates a name context generator with the specifiedfeature generators.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddFeatureGenerator(AdaptiveFeatureGenerator generator) Adds a feature generator.voidInforms all the feature generators that the context of the adaptive data (typically a document) is no longer valid and should be cleared.String[]getContext(int index, String[] tokens, String[] preds, Object[] additionalContext) Finds the context for finding names at the specified index.voidupdateAdaptiveData(String[] tokens, String[] outcomes) Informs all the feature generators that the specifiedtokenshave been classified with the corresponds set of specifiedoutcomes.
- 
Constructor Details- 
DefaultNameContextGeneratorCreates a name context generator with the specifiedfeature generators.- Parameters:
- featureGenerators- One or more- feature generators.
 
 
- 
- 
Method Details- 
addFeatureGeneratorDescription copied from interface:NameContextGeneratorAdds a feature generator.- Specified by:
- addFeatureGeneratorin interface- NameContextGenerator
- Parameters:
- generator- The- feature generatorto add.
 
- 
updateAdaptiveDataDescription copied from interface:NameContextGeneratorInforms all the feature generators that the specifiedtokenshave been classified with the corresponds set of specifiedoutcomes.- Specified by:
- updateAdaptiveDatain interface- NameContextGenerator
- Parameters:
- tokens- The tokens of a sentence or another text unit which has been processed.
- outcomes- The outcomes associated with the specified- tokens.
 
- 
clearAdaptiveDatapublic void clearAdaptiveData()Description copied from interface:NameContextGeneratorInforms all the feature generators that the context of the adaptive data (typically a document) is no longer valid and should be cleared.- Specified by:
- clearAdaptiveDatain interface- NameContextGenerator
 
- 
getContextFinds the context for finding names at the specified index.- Specified by:
- getContextin interface- BeamSearchContextGenerator<String>
- Parameters:
- index- The index of the token in the specified- tokensfor which the context should be constructed.
- tokens- The tokens of the sentence. The- toString()methods of these objects should return the token text.
- preds- The previous decisions made in the tagging of this sequence. Only indices less than- indexwill be examined.
- additionalContext- Addition features which may be based on a context outside the sentence.
- Returns:
- The context for finding names at the specified index.
 
 
-