public final class AnalyzedTokenReadings extends Object implements Iterable<AnalyzedToken>
AnalyzedTokens used to store multiple POS tags and lemmas
for a given single token.| Constructor and Description |
|---|
AnalyzedTokenReadings(AnalyzedToken[] tokens,
int startPos) |
AnalyzedTokenReadings(AnalyzedToken token,
int startPos) |
AnalyzedTokenReadings(List<AnalyzedToken> tokens,
int startPos) |
| Modifier and Type | Method and Description |
|---|---|
void |
addReading(AnalyzedToken token)
Add a new reading.
|
boolean |
equals(Object obj) |
AnalyzedToken |
getAnalyzedToken(int idx)
Get a token reading.
|
List<ChunkTag> |
getChunkTags() |
int |
getEndPos() |
String |
getHistoricalAnnotations()
Used to track disambiguator actions.
|
List<AnalyzedToken> |
getReadings() |
int |
getReadingsLength()
Number of readings.
|
int |
getStartPos() |
String |
getToken() |
int |
hashCode() |
boolean |
hasLemma(String lemma)
Checks if one of the token's readings has a particular lemma.
|
boolean |
hasPartialPosTag(String posTag)
Checks if the token has a particular POS tag, whereas only a part of the given POS tag needs to match.
|
boolean |
hasPosTag(String posTag)
Checks if the token has a particular POS tag.
|
boolean |
hasSameLemmas()
Used to optimize pattern matching.
|
void |
ignoreSpelling()
Make the token ignored by all spelling rules.
|
void |
immunize() |
boolean |
isFieldCode() |
boolean |
isIgnoredBySpeller()
Test if the token can be ignored by spelling rules.
|
boolean |
isImmunized() |
boolean |
isLinebreak()
Returns true if the token equals
\n, \r, \n\r, or \r\n. |
boolean |
isParagraphEnd() |
boolean |
isSentenceEnd() |
boolean |
isSentenceStart() |
boolean |
isTagged() |
boolean |
isWhitespace() |
boolean |
isWhitespaceBefore() |
Iterator<AnalyzedToken> |
iterator() |
void |
leaveReading(AnalyzedToken token)
Removes all readings but the one that matches the token given.
|
boolean |
matchesPosTagRegex(String posTagRegex)
Checks if at least one of the readings matches a given POS tag regex.
|
void |
removeReading(AnalyzedToken token)
Removes a reading from the list of readings.
|
void |
setChunkTags(List<ChunkTag> chunkTags) |
void |
setHistoricalAnnotations(String historicalAnnotations)
Used to track disambiguator actions.
|
void |
setParagraphEnd()
Add a reading with a paragraph end token unless this is already a paragraph end.
|
void |
setSentEnd()
Add a SENT_END tag.
|
void |
setStartPos(int position) |
void |
setWhitespaceBefore(boolean isWhiteSpaceBefore) |
String |
toString() |
public AnalyzedTokenReadings(AnalyzedToken[] tokens, int startPos)
public AnalyzedTokenReadings(AnalyzedToken token, int startPos)
public AnalyzedTokenReadings(List<AnalyzedToken> tokens, int startPos)
public List<AnalyzedToken> getReadings()
public AnalyzedToken getAnalyzedToken(int idx)
public boolean hasPosTag(String posTag)
posTag - POS tag to look forpublic boolean hasLemma(String lemma)
lemma - lemma POS tag to look forpublic boolean hasPartialPosTag(String posTag)
posTag - POS tag substring to look forpublic boolean matchesPosTagRegex(String posTagRegex)
posTagRegex - POS tag regular expression to look forpublic void addReading(AnalyzedToken token)
token - new reading, given as AnalyzedTokenpublic void removeReading(AnalyzedToken token)
token - reading to be removedpublic void leaveReading(AnalyzedToken token)
token - Token to be matchedpublic int getReadingsLength()
public boolean isWhitespace()
public boolean isLinebreak()
\n, \r, \n\r, or \r\n.public boolean isSentenceStart()
public boolean isParagraphEnd()
public void setParagraphEnd()
public boolean isSentenceEnd()
public boolean isFieldCode()
public void setSentEnd()
public int getStartPos()
public int getEndPos()
public void setStartPos(int position)
public String getToken()
public void setWhitespaceBefore(boolean isWhiteSpaceBefore)
public boolean isWhitespaceBefore()
public void immunize()
public boolean isImmunized()
public void ignoreSpelling()
public boolean isIgnoredBySpeller()
public String getHistoricalAnnotations()
public void setHistoricalAnnotations(String historicalAnnotations)
historicalAnnotations - the historicalAnnotations to setpublic boolean isTagged()
public boolean hasSameLemmas()
AnalyzedToken lemmas are the same.public Iterator<AnalyzedToken> iterator()
iterator in interface Iterable<AnalyzedToken>