Package org.languagetool.rules.patterns
Class MatchState
java.lang.Object
org.languagetool.rules.patterns.MatchState
The state of a matching process. This state is NOT thread-safe.
- Since:
- 2.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AnalyzedTokenReadings
private final Match
private AnalyzedTokenReadings
private String
private final Synthesizer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) String
convertCase
(String s, String sample, Language lang) Converts case of the string token according to match element attributes.final AnalyzedTokenReadings
getMatch()
private List
<AnalyzedToken> getNewToken
(int numRead, String token) final String
Format POS tag using parameters already defined in the class.void
setToken
(AnalyzedTokenReadings token) final void
setToken
(AnalyzedTokenReadings[] tokens, int index, int next) Sets the token to be formatted etc.final String[]
toFinalString
(Language lang) Gets all strings formatted using the match element.(package private) final String
Method for getting the formatted match as a single string.
-
Field Details
-
match
-
synthesizer
-
formattedToken
-
matchedToken
-
skippedTokens
-
-
Constructor Details
-
MatchState
-
-
Method Details
-
setToken
-
setToken
Sets the token to be formatted etc. and includes the support for including the skipped tokens.- Parameters:
tokens
- Array of tokensindex
- Index of the token to be formattednext
- Position of the next token (the skipped tokens are the ones between the tokens[index] and tokens[next]
-
filterReadings
-
convertCase
Converts case of the string token according to match element attributes.- Parameters:
s
- Token to be converted.sample
- the sample string used to determine how the original string looks like (used only on case preservation)- Returns:
- Converted string.
-
getNewToken
-
toFinalString
Gets all strings formatted using the match element.- Throws:
IOException
-
getTargetPosTag
Format POS tag using parameters already defined in the class.- Returns:
- Formatted POS tag as String.
-
toTokenString
Method for getting the formatted match as a single string. In case of multiple matches, it joins them using a regular expression operator "|".- Returns:
- Formatted string of the matched token.
- Throws:
IOException
-
getMatch
-