Package org.languagetool.rules.patterns
Class Match
- java.lang.Object
-
- org.languagetool.rules.patterns.Match
-
public final class Match extends java.lang.Object
AMatch
is the configuration of an algorithm used to matchAnalyzedTokenReadings
s. In XML, it's the<match/>
element. UsecreateState(Synthesizer, AnalyzedTokenReadings)
andcreateState(Synthesizer, AnalyzedTokenReadings[], int, int)
to create aMatchState
used to actually matchAnalyzedTokenReadings
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Match.CaseConversion
Possible string case conversions.static class
Match.IncludeRange
-
Field Summary
Fields Modifier and Type Field Description private Match.CaseConversion
caseConversionType
private Match.IncludeRange
includeSkipped
private boolean
inMessageOnly
private java.lang.String
lemma
private java.lang.String
posTag
private boolean
postagRegexp
private java.lang.String
posTagReplace
private java.util.regex.Pattern
pPosRegexMatch
private java.util.regex.Pattern
pRegexMatch
private java.lang.String
regexReplace
private boolean
setPos
private boolean
staticLemma
private boolean
suppressMisspelled
private int
tokenRef
-
Constructor Summary
Constructors Constructor Description Match(java.lang.String posTag, java.lang.String posTagReplace, boolean postagRegexp, java.lang.String regexMatch, java.lang.String regexReplace, Match.CaseConversion caseConversionType, boolean setPOS, boolean suppressMisspelled, Match.IncludeRange includeSkipped)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
checksSpelling()
Used to tell whether the Match class will spell-check the result so that misspelled suggestions are suppressed.boolean
convertsCase()
Used to let LT know that it should change the case of the match.MatchState
createState(Synthesizer synthesizer, AnalyzedTokenReadings token)
Creates a state used for actually matching a token.MatchState
createState(Synthesizer synthesizer, AnalyzedTokenReadings[] tokens, int index, int next)
Creates a state used for actually matching a token.Match.CaseConversion
getCaseConversionType()
Match.IncludeRange
getIncludeSkipped()
java.lang.String
getLemma()
java.util.regex.Pattern
getPosRegexMatch()
java.lang.String
getPosTag()
java.lang.String
getPosTagReplace()
java.util.regex.Pattern
getRegexMatch()
java.lang.String
getRegexReplace()
int
getTokenRef()
Gets the token number referenced by the match.boolean
isInMessageOnly()
boolean
isPostagRegexp()
boolean
isStaticLemma()
boolean
posRegExp()
Checks if the Match element uses regexp-based form of the POS tag.void
setInMessageOnly(boolean inMessageOnly)
void
setLemmaString(java.lang.String lemmaString)
Sets a base form (lemma) that will be formatted, or synthesized, using the specified POS regular expressions.boolean
setsPos()
Checks if the Match element is used for setting the part of speech:setpos="yes"
in XML.void
setTokenRef(int i)
Sets the token number referenced by the match.
-
-
-
Field Detail
-
posTag
private final java.lang.String posTag
-
suppressMisspelled
private final boolean suppressMisspelled
-
regexReplace
private final java.lang.String regexReplace
-
posTagReplace
private final java.lang.String posTagReplace
-
caseConversionType
private final Match.CaseConversion caseConversionType
-
includeSkipped
private final Match.IncludeRange includeSkipped
-
pRegexMatch
private final java.util.regex.Pattern pRegexMatch
-
setPos
private final boolean setPos
-
postagRegexp
private boolean postagRegexp
-
staticLemma
private boolean staticLemma
-
lemma
private java.lang.String lemma
-
tokenRef
private int tokenRef
-
pPosRegexMatch
private java.util.regex.Pattern pPosRegexMatch
-
inMessageOnly
private boolean inMessageOnly
-
-
Constructor Detail
-
Match
public Match(java.lang.String posTag, java.lang.String posTagReplace, boolean postagRegexp, java.lang.String regexMatch, java.lang.String regexReplace, Match.CaseConversion caseConversionType, boolean setPOS, boolean suppressMisspelled, Match.IncludeRange includeSkipped)
-
-
Method Detail
-
createState
public MatchState createState(Synthesizer synthesizer, AnalyzedTokenReadings token)
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
public void setLemmaString(java.lang.String lemmaString)
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
public java.lang.String 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
public Match.CaseConversion getCaseConversionType()
- Since:
- 2.3
-
setInMessageOnly
public void setInMessageOnly(boolean inMessageOnly)
-
isInMessageOnly
public boolean isInMessageOnly()
-
getPosTag
public java.lang.String getPosTag()
- Since:
- 2.3
-
getRegexMatch
public java.util.regex.Pattern getRegexMatch()
- Since:
- 2.3
-
getRegexReplace
public java.lang.String getRegexReplace()
- Since:
- 2.3
-
getPosRegexMatch
public java.util.regex.Pattern getPosRegexMatch()
- Since:
- 2.3
-
isPostagRegexp
public boolean isPostagRegexp()
- Since:
- 2.3
-
getPosTagReplace
public java.lang.String getPosTagReplace()
- Since:
- 2.3
-
getIncludeSkipped
public Match.IncludeRange getIncludeSkipped()
- Since:
- 2.3
-
-