edu.northwestern.at.morphadorner.corpuslinguistics.postagger.unigram

## Class UnigramTagger

- java.lang.Object
- - edu.northwestern.at.utils.IsCloseableObject
  - - edu.northwestern.at.morphadorner.corpuslinguistics.postagger.AbstractPartOfSpeechTagger
    - - edu.northwestern.at.morphadorner.corpuslinguistics.postagger.unigram.UnigramTagger

- All Implemented Interfaces:
    UsesLexicon, CanTagOneWord, PartOfSpeechTagger, IsCloseable, UsesLogger
  Direct Known Subclasses:
    AffixTagger, IRetagger, NoopRetagger, ProperNounRetagger, RegexpTagger, SimpleRuleBasedTagger, SuffixTagger, TCPRetagger

      public class UnigramTagger
      extends AbstractPartOfSpeechTagger
      implements PartOfSpeechTagger, CanTagOneWord

  Unigram Part of Speech tagger.

  The unigram part of speech tagger uses a lexicon to assign the most frequently occurring part of speech tag to a spelling.

- - ### Field Summary

    - ### Fields inherited from class edu.northwestern.at.morphadorner.corpuslinguistics.postagger.AbstractPartOfSpeechTagger

      `contextRules, contextualSmoother, dynamicLexicon, lexicalRules, lexicalSmoother, lexicon, logger, partOfSpeechGuesser, postTokenizer, retagger, ruleCorrections, transitionMatrix`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UnigramTagger()` Create a unigram tagger.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T extends AdornedWord> java.util.List<T>` | `tagAdornedWordList(java.util.List<T> sentence)` Tag an adorned word list.
    `java.lang.String` | `tagWord(AdornedWord word)` Tag a single word.
    `java.lang.String` | `tagWord(java.lang.String word)` Tag a single word.
    `java.lang.String` | `toString()` Return tagger description.

    - ### Methods inherited from class edu.northwestern.at.morphadorner.corpuslinguistics.postagger.AbstractPartOfSpeechTagger

      `clearRuleCorrections, createPartOfSpeechGuesser, getContextualSmoother, getDynamicLexicon, getLexicalSmoother, getLexicon, getLexicon, getLogger, getMostCommonTag, getPartOfSpeechGuesser, getPostTokenizer, getRetagger, getRuleCorrections, getTagCount, getTagsForWord, getTransitionMatrix, incrementRuleCorrections, retagWords, setContextRules, setContextualSmoother, setLexicalRules, setLexicalSmoother, setLexicon, setLogger, setPartOfSpeechGuesser, setPostTokenizer, setRetagger, setTransitionMatrix, tagAdornedWordSentence, tagAdornedWordSentences, tagSentence, tagSentences, usesContextRules, usesLexicalRules, usesTransitionProbabilities`

    - ### Methods inherited from class edu.northwestern.at.utils.IsCloseableObject

      `close`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface edu.northwestern.at.morphadorner.corpuslinguistics.postagger.PartOfSpeechTagger

      `clearRuleCorrections, getContextualSmoother, getLexicalSmoother, getLexicon, getLexicon, getPartOfSpeechGuesser, getPostTokenizer, getRetagger, getRuleCorrections, getTagCount, getTagsForWord, getTransitionMatrix, incrementRuleCorrections, retagWords, setContextRules, setContextualSmoother, setLexicalRules, setLexicalSmoother, setLexicon, setPartOfSpeechGuesser, setPostTokenizer, setRetagger, setTransitionMatrix, tagAdornedWordSentence, tagAdornedWordSentences, tagSentence, tagSentences, usesContextRules, usesLexicalRules, usesTransitionProbabilities`

    - ### Methods inherited from interface edu.northwestern.at.utils.IsCloseable

      `close`

- - ### Constructor Detail

    - #### UnigramTagger

          public UnigramTagger()

      Create a unigram tagger.

  - ### Method Detail

    - #### tagAdornedWordList

          public <T extends AdornedWord> java.util.List<T> tagAdornedWordList(java.util.List<T> sentence)

      Tag an adorned word list.
      Specified by:
        `tagAdornedWordList` in interface `PartOfSpeechTagger`
      Specified by:
        `tagAdornedWordList` in class `AbstractPartOfSpeechTagger`
      Parameters:
        `sentence` - The sentence as a list of adorned words.
      Returns:
        An `AdornedWord` of the words in the sentence tagged with parts of speech.

        The input sentence is a `AdornedWord` of words to tag. The output is the same list with parts of speech added.

    - #### tagWord

          public java.lang.String tagWord(java.lang.String word)

      Tag a single word.
      Specified by:
        `tagWord` in interface `CanTagOneWord`
      Parameters:
        `word` - The word.
      Returns:
        The part of speech for the word.

        Returns most common tag for word.

    - #### tagWord

          public java.lang.String tagWord(AdornedWord word)

      Tag a single word.
      Specified by:
        `tagWord` in interface `CanTagOneWord`
      Parameters:
        `word` - The word as an AdornedWord.
      Returns:
        The part of speech for the word. The part of speech is also set in the input AdornedWord.

        Returns most common tag for word.

    - #### toString

          public java.lang.String toString()

      Return tagger description.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        Tagger description.