Package org.languagetool
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)- Author:
- Daniel Naber
-
-
Constructor Summary
Constructors Constructor Description AnalyzedToken(String token, String posTag, String lemma)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
@Nullable String
getLemma()
@Nullable String
getPOSTag()
String
getToken()
int
hashCode()
boolean
hasNoTag()
boolean
isWhitespaceBefore()
boolean
matches(AnalyzedToken an)
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.void
setWhitespaceBefore(boolean whitespaceBefore)
String
toString()
-
-
-
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
-
-