Class DefaultNameContextGenerator
java.lang.Object
opennlp.tools.namefind.DefaultNameContextGenerator
- All Implemented Interfaces:
opennlp.tools.namefind.NameContextGenerator, opennlp.tools.util.BeamSearchContextGenerator<String>
public class DefaultNameContextGenerator
extends Object
implements opennlp.tools.namefind.NameContextGenerator
A
NameContextGenerator implementation for determining contextual features
for a tag-chunk style named-entity recognizer.-
Constructor Summary
ConstructorsConstructorDescriptionDefaultNameContextGenerator(opennlp.tools.util.featuregen.AdaptiveFeatureGenerator... featureGenerators) Creates a name context generator with the specifiedfeature generators. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFeatureGenerator(opennlp.tools.util.featuregen.AdaptiveFeatureGenerator generator) voidString[]getContext(int index, String[] tokens, String[] preds, Object[] additionalContext) Finds the context for finding names at the specified index.voidupdateAdaptiveData(String[] tokens, String[] outcomes)
-
Constructor Details
-
DefaultNameContextGenerator
public DefaultNameContextGenerator(opennlp.tools.util.featuregen.AdaptiveFeatureGenerator... featureGenerators) Creates a name context generator with the specifiedfeature generators.- Parameters:
featureGenerators- One or morefeature generators.
-
-
Method Details
-
addFeatureGenerator
public void addFeatureGenerator(opennlp.tools.util.featuregen.AdaptiveFeatureGenerator generator) - Specified by:
addFeatureGeneratorin interfaceopennlp.tools.namefind.NameContextGenerator
-
updateAdaptiveData
-
clearAdaptiveData
public void clearAdaptiveData()- Specified by:
clearAdaptiveDatain interfaceopennlp.tools.namefind.NameContextGenerator
-
getContext
Finds the context for finding names at the specified index.- Specified by:
getContextin interfaceopennlp.tools.util.BeamSearchContextGenerator<String>- Parameters:
index- The index of the token in the specifiedtokensfor which the context should be constructed.tokens- The tokens of the sentence. ThetoString()methods of these objects should return the token text.preds- The previous decisions made in the tagging of this sequence. Only indices less thanindexwill 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.
-