Package org.languagetool.rules.patterns
Class Match
java.lang.Object
org.languagetool.rules.patterns.Match
A
Match is the configuration of an algorithm used to match AnalyzedTokenReadingss.
In XML, it's the <match/> element.
Use createState(Synthesizer, AnalyzedTokenReadings) and createState(Synthesizer, AnalyzedTokenReadings[], int, int)
to create a MatchState used to actually match AnalyzedTokenReadings.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumPossible string case conversions.static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Match.CaseConversionprivate final Match.IncludeRangeprivate booleanprivate Stringprivate final Stringprivate booleanprivate final Stringprivate Patternprivate final Patternprivate final Stringprivate final booleanprivate booleanprivate final booleanprivate int -
Constructor Summary
ConstructorsConstructorDescriptionMatch(String posTag, String posTagReplace, boolean postagRegexp, String regexMatch, String regexReplace, Match.CaseConversion caseConversionType, boolean setPOS, boolean suppressMisspelled, Match.IncludeRange includeSkipped) -
Method Summary
Modifier and TypeMethodDescriptionbooleanUsed to tell whether the Match class will spell-check the result so that misspelled suggestions are suppressed.booleanUsed to let LT know that it should change the case of the match.createState(Synthesizer synthesizer, AnalyzedTokenReadings token) Creates a state used for actually matching a token.createState(Synthesizer synthesizer, AnalyzedTokenReadings[] tokens, int index, int next) Creates a state used for actually matching a token.getLemma()intGets the token number referenced by the match.booleanbooleanbooleanbooleanChecks if the Match element uses regexp-based form of the POS tag.voidsetInMessageOnly(boolean inMessageOnly) voidsetLemmaString(String lemmaString) Sets a base form (lemma) that will be formatted, or synthesized, using the specified POS regular expressions.booleansetsPos()Checks if the Match element is used for setting the part of speech:setpos="yes"in XML.voidsetTokenRef(int i) Sets the token number referenced by the match.
-
Field Details
-
posTag
-
suppressMisspelled
private final boolean suppressMisspelled -
regexReplace
-
posTagReplace
-
caseConversionType
-
includeSkipped
-
pRegexMatch
-
setPos
private final boolean setPos -
postagRegexp
private boolean postagRegexp -
staticLemma
private boolean staticLemma -
lemma
-
tokenRef
private int tokenRef -
pPosRegexMatch
-
inMessageOnly
private boolean inMessageOnly
-
-
Constructor Details
-
Match
public Match(String posTag, String posTagReplace, boolean postagRegexp, String regexMatch, String regexReplace, Match.CaseConversion caseConversionType, boolean setPOS, boolean suppressMisspelled, Match.IncludeRange includeSkipped)
-
-
Method Details
-
createState
Creates a state used for actually matching a token.- Since:
- 2.3
-
createState
public MatchState createState(Synthesizer synthesizer, AnalyzedTokenReadings[] tokens, int index, int next) Creates a state used for actually matching a token.- Since:
- 2.3
-
setsPos
public boolean setsPos()Checks if the Match element is used for setting the part of speech:setpos="yes"in XML.- Returns:
- True if Match sets POS.
-
posRegExp
public boolean posRegExp()Checks if the Match element uses regexp-based form of the POS tag.- Returns:
- True if regexp is used in POS.
-
setLemmaString
Sets a base form (lemma) that will be formatted, or synthesized, using the specified POS regular expressions.- Parameters:
lemmaString- String that specifies the base form.
-
getLemma
- Since:
- 2.3
-
isStaticLemma
public boolean isStaticLemma()- Since:
- 2.3
-
checksSpelling
public boolean checksSpelling()Used to tell whether the Match class will spell-check the result so that misspelled suggestions are suppressed.- Returns:
- True if this is so.
-
setTokenRef
public void setTokenRef(int i) Sets the token number referenced by the match.- Parameters:
i- Token number.
-
getTokenRef
public int getTokenRef()Gets the token number referenced by the match.- Returns:
- token number.
-
convertsCase
public boolean convertsCase()Used to let LT know that it should change the case of the match.- Returns:
- true if match converts the case of the token.
-
getCaseConversionType
- Since:
- 2.3
-
setInMessageOnly
public void setInMessageOnly(boolean inMessageOnly) -
isInMessageOnly
public boolean isInMessageOnly() -
getPosTag
- Since:
- 2.3
-
getRegexMatch
- Since:
- 2.3
-
getRegexReplace
- Since:
- 2.3
-
getPosRegexMatch
- Since:
- 2.3
-
isPostagRegexp
public boolean isPostagRegexp()- Since:
- 2.3
-
getPosTagReplace
- Since:
- 2.3
-
getIncludeSkipped
- Since:
- 2.3
-