public class PatternRule extends AbstractPatternRule
endPositionCorrection, language, patternTokens, sentStart, startPositionCorrection, subId, testUnification| Constructor and Description |
|---|
PatternRule(String id,
Language language,
List<PatternToken> patternTokens,
String description,
String message,
String shortMessage) |
PatternRule(String id,
Language language,
List<PatternToken> patternTokens,
String description,
String message,
String shortMessage,
String suggestionsOutMsg) |
PatternRule(String id,
Language language,
List<PatternToken> patternTokens,
String description,
String message,
String shortMessage,
String suggestionsOutMsg,
boolean isMember) |
| Modifier and Type | Method and Description |
|---|---|
void |
addSuggestionMatch(Match m)
Add formatted suggestion elements.
|
void |
addSuggestionMatchOutMsg(Match m)
Add formatted suggestion elements outside message.
|
boolean |
canBeIgnoredFor(AnalyzedSentence sentence)
A fast check whether this rule can be ignored for the given sentence
because it can never match.
|
String |
getMessage()
Get the message shown to the user if this rule matches.
|
String |
getSuggestionsOutMsg() |
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 |
setAntiPatterns(List<DisambiguationPatternRule> antiPatterns)
Set up the list of antipatterns used to immunize tokens, i.e., make them
non-matchable by the current rule.
|
void |
setMessage(String message)
Set the message shown to the user if this rule matches.
|
String |
toPatternString()
Return the pattern as a string, using toString() on the pattern elements.
|
String |
toXML()
Return the rule's definition as an XML string, loaded from the XML rule files.
|
getDescription, getEndPositionCorrection, getId, getLanguage, getPatternTokens, getStartPositionCorrection, getSubId, isGetUnified, isGroupsOrUnification, isSentStart, isTestUnification, reset, setEndPositionCorrection, setStartPositionCorrection, setSubId, supportsLanguage, toStringaddExamplePair, getCategory, getCorrectExamples, getIncorrectExamples, getLocQualityIssueType, getUrl, isDefaultOff, isDictionaryBasedSpellingRule, setCategory, setCorrectExamples, setDefaultOff, setDefaultOn, setIncorrectExamples, setLocQualityIssueType, setUrl, toRuleMatchArray, useInOfficepublic PatternRule(String id, Language language, List<PatternToken> patternTokens, String description, String message, String shortMessage)
id - Id of the Rule. Used in configuration. Should not contain special characters and should
be stable over time, unless the rule changes completely.language - Language of the Ruledescription - Description to be shown (name)message - Message to be displayed to the usershortMessage - Message to be displayed to the user in the context menu in OpenOffice.org/LibreOfficepublic PatternRule(String id, Language language, List<PatternToken> patternTokens, String description, String message, String shortMessage, String suggestionsOutMsg)
public final String getMessage()
public final void setMessage(String message)
public final String getSuggestionsOutMsg()
public final String toPatternString()
public final String toXML()
public final RuleMatch[] match(AnalyzedSentence sentence) throws IOException
Rulematch in class AbstractPatternRulesentence - a pre-analyzed sentenceRuleMatch objectsIOExceptionpublic final void addSuggestionMatch(Match m)
public final void addSuggestionMatchOutMsg(Match m)
public boolean canBeIgnoredFor(AnalyzedSentence sentence)
public void setAntiPatterns(List<DisambiguationPatternRule> antiPatterns)
antiPatterns - A list of antiPatterns, implemented as DisambiguationPatternRule.