Class POSTaggerME

  • All Implemented Interfaces:
    POSTagger

    public class POSTaggerME
    extends Object
    implements POSTagger
    A part-of-speech tagger that uses maximum entropy. Tries to predict whether words are nouns, verbs, or any of 70 other POS tags depending on their surrounding context.
    • Constructor Detail

      • POSTaggerME

        public POSTaggerME​(String language)
                    throws IOException
        Initializes the sentence detector by downloading a default model.
        Parameters:
        language - The language of the POS tagger
        Throws:
        IOException - Thrown if the model cannot be downloaded or saved.
      • POSTaggerME

        public POSTaggerME​(POSModel model)
        Initializes the current instance with the provided model.
        Parameters:
        model -
    • Method Detail

      • getAllPosTags

        public String[] getAllPosTags()
        Retrieves an array of all possible part-of-speech tags from the tagger.
        Returns:
        String[]
      • tag

        public String[] tag​(String[] sentence)
        Description copied from interface: POSTagger
        Assigns the sentence of tokens pos tags.
        Specified by:
        tag in interface POSTagger
        Parameters:
        sentence - The sentece of tokens to be tagged.
        Returns:
        an array of pos tags for each token provided in sentence.
      • tag

        public String[][] tag​(int numTaggings,
                              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.
      • 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.