Package opennlp.tools.postag
Class DefaultPOSContextGenerator
java.lang.Object
opennlp.tools.postag.DefaultPOSContextGenerator
- All Implemented Interfaces:
POSContextGenerator,BeamSearchContextGenerator<String>
A context generator for the POS Tagger.
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultPOSContextGenerator(int cacheSize, Dictionary dict) Initializes the current instance.Initializes the current instance. -
Method Summary
Modifier and TypeMethodDescriptionString[]getContext(int index, Object[] tokens, String[] tags) Returns the context for making a pos tag decision at the specified token index given the specified tokens and previous tags.String[]getContext(int index, String[] sequence, String[] priorDecisions, Object[] additionalContext) Returns the context for the specified position in the specified sequence (list).
-
Constructor Details
-
DefaultPOSContextGenerator
Initializes the current instance.- Parameters:
dict-
-
DefaultPOSContextGenerator
Initializes the current instance.- Parameters:
cacheSize-dict-
-
-
Method Details
-
getContext
public String[] getContext(int index, String[] sequence, String[] priorDecisions, Object[] additionalContext) Description copied from interface:BeamSearchContextGeneratorReturns the context for the specified position in the specified sequence (list).- Specified by:
getContextin interfaceBeamSearchContextGenerator<String>- Specified by:
getContextin interfacePOSContextGenerator- Parameters:
index- The index of the sequence.sequence- The sequence of items over which the beam search is performed.priorDecisions- The sequence of decisions made prior to the context for which this decision is being made.additionalContext- Any addition context specific to a class implementing this interface.- Returns:
- the context for the specified position in the specified sequence.
-
getContext
Returns the context for making a pos tag decision at the specified token index given the specified tokens and previous tags.- Parameters:
index- The index of the token for which the context is provided.tokens- The tokens in the sentence.tags- The tags assigned to the previous words in the sentence.- Returns:
- The context for making a pos tag decision at the specified token index given the specified tokens and previous tags.
-