Class AnalyzedToken


  • public final class AnalyzedToken
    extends Object
    A word (or punctuation, or whitespace) and its analysis (part-of-speech tag, lemma)
    Author:
    Daniel Naber
    • Constructor Detail

    • Method Detail

      • 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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object