Package opennlp.tools.postag
Class ConfigurablePOSContextGenerator
java.lang.Object
opennlp.tools.postag.ConfigurablePOSContextGenerator
- All Implemented Interfaces:
POSContextGenerator,BeamSearchContextGenerator<String>
A configurable
context generator for a POSTagger.
This implementation makes use of AdaptiveFeatureGenerator.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConfigurablePOSContextGenerator(int cacheSize, AdaptiveFeatureGenerator featureGenerator) Initializes aConfigurablePOSContextGeneratorinstance.ConfigurablePOSContextGenerator(AdaptiveFeatureGenerator featureGenerator) Initializes aConfigurablePOSContextGeneratorinstance. -
Method Summary
Modifier and TypeMethodDescriptionString[]getContext(int index, String[] tokens, String[] tags, Object[] additionalContext) Returns the context for making a postag decision at the specified tokenindexgiven the specifiedtokensand previoustags.
-
Constructor Details
-
ConfigurablePOSContextGenerator
Initializes aConfigurablePOSContextGeneratorinstance. A cache size of0will be used as default.- Parameters:
featureGenerator- TheAdaptiveFeatureGeneratorto be used.
-
ConfigurablePOSContextGenerator
Initializes aConfigurablePOSContextGeneratorinstance.- Parameters:
cacheSize- The size of theCacheto set. Must be greater than0to have an effect.featureGenerator- TheAdaptiveFeatureGeneratorto be used.
-
-
Method Details
-
getContext
Returns the context for making a postag decision at the specified tokenindexgiven the specifiedtokensand previoustags.- Specified by:
getContextin interfaceBeamSearchContextGenerator<String>- Specified by:
getContextin interfacePOSContextGenerator- Parameters:
index- The index of the token for which the context is provided.tokens- The tokens representing a sentence.tags- The tags assigned to the previous words in the sentence.additionalContext- The context for additional information.- Returns:
- The context for making a postag decision at the specified token
indexgiven the specifiedtokensand previoustags.
-