Package opennlp.tools.postag
Class ConfigurablePOSContextGenerator
- java.lang.Object
-
- opennlp.tools.postag.ConfigurablePOSContextGenerator
-
- All Implemented Interfaces:
POSContextGenerator
,BeamSearchContextGenerator<String>
public class ConfigurablePOSContextGenerator extends Object implements POSContextGenerator
A configurablecontext generator
for aPOSTagger
. This implementation makes use ofAdaptiveFeatureGenerator
.- See Also:
POSTagger
,POSTaggerME
,DefaultPOSContextGenerator
-
-
Constructor Summary
Constructors Constructor Description ConfigurablePOSContextGenerator(int cacheSize, AdaptiveFeatureGenerator featureGenerator)
Initializes aConfigurablePOSContextGenerator
instance.ConfigurablePOSContextGenerator(AdaptiveFeatureGenerator featureGenerator)
Initializes aConfigurablePOSContextGenerator
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String[]
getContext(int index, String[] tokens, String[] tags, Object[] additionalContext)
Returns the context for making a postag decision at the specified tokenindex
given the specifiedtokens
and previoustags
.
-
-
-
Constructor Detail
-
ConfigurablePOSContextGenerator
public ConfigurablePOSContextGenerator(AdaptiveFeatureGenerator featureGenerator)
Initializes aConfigurablePOSContextGenerator
instance. A cache size of0
will be used as default.- Parameters:
featureGenerator
- TheAdaptiveFeatureGenerator
to be used.
-
ConfigurablePOSContextGenerator
public ConfigurablePOSContextGenerator(int cacheSize, AdaptiveFeatureGenerator featureGenerator)
Initializes aConfigurablePOSContextGenerator
instance.- Parameters:
cacheSize
- The size of theCache
to set. Must be greater than0
to have an effect.featureGenerator
- TheAdaptiveFeatureGenerator
to be used.
-
-
Method Detail
-
getContext
public String[] getContext(int index, String[] tokens, String[] tags, Object[] additionalContext)
Returns the context for making a postag decision at the specified tokenindex
given the specifiedtokens
and previoustags
.- Specified by:
getContext
in interfaceBeamSearchContextGenerator<String>
- Specified by:
getContext
in 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
index
given the specifiedtokens
and previoustags
.
-
-