Package opennlp.tools.namefind
Class DefaultNameContextGenerator
- java.lang.Object
 - 
- opennlp.tools.namefind.DefaultNameContextGenerator
 
 
- 
- All Implemented Interfaces:
 NameContextGenerator,BeamSearchContextGenerator<java.lang.String>
public class DefaultNameContextGenerator extends java.lang.Object implements NameContextGenerator
Class for determining contextual features for a tag/chunk style named-entity recognizer. 
- 
- 
Constructor Summary
Constructors Constructor Description DefaultNameContextGenerator()Deprecated.use the other constructor and always provide the feature generatorsDefaultNameContextGenerator(AdaptiveFeatureGenerator... featureGenerators)Creates a name context generator with the specified cache size. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFeatureGenerator(AdaptiveFeatureGenerator generator)Adds a feature generator to this set of feature generators.voidclearAdaptiveData()Informs all the feature generators for a name finder that the context of the adaptive data (typically a document) is no longer valid.java.lang.String[]getContext(int index, java.lang.String[] tokens, java.lang.String[] preds, java.lang.Object[] additionalContext)Return the context for finding names at the specified index.voidupdateAdaptiveData(java.lang.String[] tokens, java.lang.String[] outcomes)Informs all the feature generators for a name finder that the specified tokens have been classified with the coorisponds set of specified outcomes. 
 - 
 
- 
- 
Constructor Detail
- 
DefaultNameContextGenerator
@Deprecated public DefaultNameContextGenerator()
Deprecated.use the other constructor and always provide the feature generatorsCreates a name context generator. 
- 
DefaultNameContextGenerator
public DefaultNameContextGenerator(AdaptiveFeatureGenerator... featureGenerators)
Creates a name context generator with the specified cache size. 
 - 
 
- 
Method Detail
- 
addFeatureGenerator
public void addFeatureGenerator(AdaptiveFeatureGenerator generator)
Description copied from interface:NameContextGeneratorAdds a feature generator to this set of feature generators.- Specified by:
 addFeatureGeneratorin interfaceNameContextGenerator- Parameters:
 generator- The feature generator to add.
 
- 
updateAdaptiveData
public void updateAdaptiveData(java.lang.String[] tokens, java.lang.String[] outcomes)Description copied from interface:NameContextGeneratorInforms all the feature generators for a name finder that the specified tokens have been classified with the coorisponds set of specified outcomes.- Specified by:
 updateAdaptiveDatain interfaceNameContextGenerator- Parameters:
 tokens- The tokens of the sentence or other text unit which has been processed.outcomes- The outcomes associated with the specified tokens.
 
- 
clearAdaptiveData
public void clearAdaptiveData()
Description copied from interface:NameContextGeneratorInforms all the feature generators for a name finder that the context of the adaptive data (typically a document) is no longer valid.- Specified by:
 clearAdaptiveDatain interfaceNameContextGenerator
 
- 
getContext
public java.lang.String[] getContext(int index, java.lang.String[] tokens, java.lang.String[] preds, java.lang.Object[] additionalContext)Return the context for finding names at the specified index.- Specified by:
 getContextin interfaceBeamSearchContextGenerator<java.lang.String>- Parameters:
 index- The index of the token in the specified toks array for which the context should be constructed.tokens- The tokens of the sentence. ThetoStringmethods of these objects should return the token text.preds- The previous decisions made in the tagging of this sequence. Only indices less than i will be examined.additionalContext- Addition features which may be based on a context outside of the sentence.- Returns:
 - the context for finding names at the specified index.
 
 
 - 
 
 -