public abstract class AbstractPatternRule extends Rule
| Modifier and Type | Field and Description |
|---|---|
protected int |
endPositionCorrection |
protected Language |
language |
protected List<PatternToken> |
patternTokens |
protected boolean |
sentStart |
protected int |
startPositionCorrection |
protected String |
subId |
protected boolean |
testUnification |
| Constructor and Description |
|---|
AbstractPatternRule(String id,
String description,
Language language,
List<PatternToken> patternTokens,
boolean getUnified) |
| Modifier and Type | Method and Description |
|---|---|
String |
getDescription()
A short description of the error this rule can detect, usually in the language of the text
that is checked.
|
int |
getEndPositionCorrection() |
String |
getId()
A string used to identify the rule in e.g. configuration files.
|
Language |
getLanguage() |
List<PatternToken> |
getPatternTokens() |
int |
getStartPositionCorrection() |
String |
getSubId() |
boolean |
isGetUnified() |
boolean |
isGroupsOrUnification() |
boolean |
isSentStart() |
boolean |
isTestUnification() |
RuleMatch[] |
match(AnalyzedSentence sentence)
Check whether the given sentence matches this error rule, i.e. whether it
contains the error detected by this rule.
|
void |
reset()
If a rule keeps its state over more than the check of one sentence, this
must be implemented so the internal state is reset.
|
void |
setEndPositionCorrection(int endPositionCorrection) |
void |
setStartPositionCorrection(int startPositionCorrection) |
void |
setSubId(String subId) |
boolean |
supportsLanguage(Language language)
Whether this rule can be used for text in the given language.
|
String |
toString() |
addExamplePair, getCategory, getCorrectExamples, getIncorrectExamples, getLocQualityIssueType, getUrl, isDefaultOff, isDictionaryBasedSpellingRule, setCategory, setCorrectExamples, setDefaultOff, setDefaultOn, setIncorrectExamples, setLocQualityIssueType, setUrl, toRuleMatchArray, useInOfficeprotected final Language language
protected final List<PatternToken> patternTokens
protected final boolean testUnification
protected final boolean sentStart
protected String subId
protected int startPositionCorrection
protected int endPositionCorrection
public AbstractPatternRule(String id, String description, Language language, List<PatternToken> patternTokens, boolean getUnified)
public boolean supportsLanguage(Language language)
RulePatternRules
(before, it used to always return false for those).supportsLanguage in class Rulepublic String getDescription()
RulegetDescription in class Rulepublic String getId()
RuleA-Z
and the underscore.public RuleMatch[] match(AnalyzedSentence sentence) throws IOException
Rulematch in class Rulesentence - a pre-analyzed sentenceRuleMatch objectsIOExceptionpublic void reset()
Rulepublic final Language getLanguage()
public final void setStartPositionCorrection(int startPositionCorrection)
public final int getStartPositionCorrection()
public final void setEndPositionCorrection(int endPositionCorrection)
public final int getEndPositionCorrection()
public final String getSubId()
public final void setSubId(String subId)
public boolean isGroupsOrUnification()
public boolean isGetUnified()
public boolean isSentStart()
public boolean isTestUnification()
public List<PatternToken> getPatternTokens()