Class AnalyzedToken

java.lang.Object
org.languagetool.AnalyzedToken

public final class AnalyzedToken extends Object
A word (or punctuation, or whitespace) and its analysis (part-of-speech tag, lemma)
  • Field Details

    • token

      private final String token
    • posTag

      private final String posTag
    • lemma

      private final String lemma
    • lemmaOrToken

      private final String lemmaOrToken
    • isWhitespaceBefore

      private boolean isWhitespaceBefore
    • hasNoPOSTag

      private boolean hasNoPOSTag
  • Constructor Details

  • Method Details

    • getToken

      public String getToken()
    • getPOSTag

      @Nullable public @Nullable String getPOSTag()
      Returns:
      the token's part-of-speech tag or null
    • getLemma

      @Nullable public @Nullable String getLemma()
      Returns:
      the token's lemma or null
    • setWhitespaceBefore

      public void setWhitespaceBefore(boolean whitespaceBefore)
    • isWhitespaceBefore

      public boolean isWhitespaceBefore()
    • matches

      public boolean matches(AnalyzedToken an)
      Parameters:
      an - AnalyzedToken to test
      Returns:
      true if all of the non-null values (lemma, POS, token) of AnalyzedToken match this token
      Since:
      1.5
    • hasNoTag

      public boolean hasNoTag()
      Returns:
      true if the AnalyzedToken has no real POS tag (= is not null or a special tag)
      Since:
      1.5
    • setNoPOSTag

      public void setNoPOSTag(boolean noTag)
      If other readings of the token have real POS tags, you can set the flag here that they do, so that the test in the Element class would be correct for all cases.
      Since:
      1.5
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object