Package opennlp.tools.postag
Class POSTaggerME
- java.lang.Object
 - 
- opennlp.tools.postag.POSTaggerME
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_BEAM_SIZE 
- 
Constructor Summary
Constructors Constructor Description POSTaggerME(POSModel model)Initializes the current instance with the provided model. 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DictionarybuildNGramDictionary(ObjectStream<POSSample> samples, int cutoff)java.lang.String[]getAllPosTags()Retrieves an array of all possible part-of-speech tags from the tagger.java.lang.String[]getOrderedTags(java.util.List<java.lang.String> words, java.util.List<java.lang.String> tags, int index)java.lang.String[]getOrderedTags(java.util.List<java.lang.String> words, java.util.List<java.lang.String> tags, int index, double[] tprobs)static voidpopulatePOSDictionary(ObjectStream<POSSample> samples, MutableTagDictionary dict, int cutoff)double[]probs()Returns an array with the probabilities for each tag of the last tagged sentence.voidprobs(double[] probs)Populates the specified array with the probabilities for each tag of the last tagged sentence.java.lang.String[][]tag(int numTaggings, java.lang.String[] sentence)Returns at most the specified number of taggings for the specified sentence.java.lang.String[]tag(java.lang.String[] sentence)Assigns the sentence of tokens pos tags.java.lang.String[]tag(java.lang.String[] sentence, java.lang.Object[] additionaContext)Sequence[]topKSequences(java.lang.String[] sentence)Sequence[]topKSequences(java.lang.String[] sentence, java.lang.Object[] additionaContext)static POSModeltrain(java.lang.String languageCode, ObjectStream<POSSample> samples, TrainingParameters trainParams, POSTaggerFactory posFactory) 
 - 
 
- 
- 
Field Detail
- 
DEFAULT_BEAM_SIZE
public static final int DEFAULT_BEAM_SIZE
- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Constructor Detail
- 
POSTaggerME
public POSTaggerME(POSModel model)
Initializes the current instance with the provided model.- Parameters:
 model-
 
 - 
 
- 
Method Detail
- 
getAllPosTags
public java.lang.String[] getAllPosTags()
Retrieves an array of all possible part-of-speech tags from the tagger.- Returns:
 - String[]
 
 
- 
tag
public java.lang.String[] tag(java.lang.String[] sentence)
Description copied from interface:POSTaggerAssigns the sentence of tokens pos tags. 
- 
tag
public java.lang.String[] tag(java.lang.String[] sentence, java.lang.Object[] additionaContext) 
- 
tag
public java.lang.String[][] tag(int numTaggings, java.lang.String[] sentence)Returns at most the specified number of taggings for the specified sentence.- Parameters:
 numTaggings- The number of tagging to be returned.sentence- An array of tokens which make up a sentence.- Returns:
 - At most the specified number of taggings for the specified sentence.
 
 
- 
topKSequences
public Sequence[] topKSequences(java.lang.String[] sentence)
- Specified by:
 topKSequencesin interfacePOSTagger
 
- 
topKSequences
public Sequence[] topKSequences(java.lang.String[] sentence, java.lang.Object[] additionaContext)
- Specified by:
 topKSequencesin interfacePOSTagger
 
- 
probs
public void probs(double[] probs)
Populates the specified array with the probabilities for each tag of the last tagged sentence.- Parameters:
 probs- An array to put the probabilities into.
 
- 
probs
public double[] probs()
Returns an array with the probabilities for each tag of the last tagged sentence.- Returns:
 - an array with the probabilities for each tag of the last tagged sentence.
 
 
- 
getOrderedTags
public java.lang.String[] getOrderedTags(java.util.List<java.lang.String> words, java.util.List<java.lang.String> tags, int index) 
- 
getOrderedTags
public java.lang.String[] getOrderedTags(java.util.List<java.lang.String> words, java.util.List<java.lang.String> tags, int index, double[] tprobs) 
- 
train
public static POSModel train(java.lang.String languageCode, ObjectStream<POSSample> samples, TrainingParameters trainParams, POSTaggerFactory posFactory) throws java.io.IOException
- Throws:
 java.io.IOException
 
- 
buildNGramDictionary
public static Dictionary buildNGramDictionary(ObjectStream<POSSample> samples, int cutoff) throws java.io.IOException
- Throws:
 java.io.IOException
 
- 
populatePOSDictionary
public static void populatePOSDictionary(ObjectStream<POSSample> samples, MutableTagDictionary dict, int cutoff) throws java.io.IOException
- Throws:
 java.io.IOException
 
 - 
 
 -