public class PatternRule extends AbstractTokenBasedRule
antiPatterns, endPositionCorrection, filter, filterArgs, language, message, patternTokens, sentStart, sourceFile, startPositionCorrection, subId, suggestionMatches, suggestionMatchesOutMsg, suggestionsOutMsg, testUnification, type
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) |
PatternRule(String id,
Language language,
List<PatternToken> patternTokens,
String description,
String message,
String shortMessage,
String suggestionsOutMsg,
boolean isMember,
boolean interpretPosTagsPreDisambiguation) |
Modifier and Type | Method and Description |
---|---|
int |
estimateContextForSureMatch()
A number that estimates how many words there must be after a match before we
can be (relatively) sure the match is valid.
|
String |
getShortMessage() |
RuleMatch[] |
match(AnalyzedSentence sentence)
Check whether the given sentence matches this error rule, i.e. whether it
contains the error detected by this rule.
|
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.
|
canBeIgnoredFor
addSuggestionMatch, addSuggestionMatchOutMsg, getAntiPatterns, getDescription, getEndPositionCorrection, getFilter, getFilterArguments, getFullId, getId, getLanguage, getMessage, getPatternRuleId, getPatternTokens, getSourceFile, getStartPositionCorrection, getSubId, getSuggestionsOutMsg, getType, getXmlLineNumber, isAdjustSuggestionCase, isGetUnified, isGroupsOrUnification, isSentStart, isTestUnification, setAdjustSuggestionCase, setAntiPatterns, setEndPositionCorrection, setFilter, setFilterArguments, setMessage, setStartPositionCorrection, setSubId, setType, setXmlLineNumber, supportsLanguage, toString
addExamplePair, addTags, addToneTags, cacheAntiPatterns, getCategory, getConfigureText, getCorrectExamples, getDefaultValue, getDistanceTokens, getErrorTriggeringExamples, getIncorrectExamples, getLocQualityIssueType, getMaxConfigurableValue, getMinConfigurableValue, getMinPrevMatches, getSentenceWithImmunization, getTags, getToneTags, getUrl, hasConfigurableValue, hasTag, hasToneTag, isDefaultOff, isDefaultTempOff, isDictionaryBasedSpellingRule, isGoalSpecific, isOfficeDefaultOff, isOfficeDefaultOn, isPremium, makeAntiPatterns, setCategory, setCorrectExamples, setDefaultOff, setDefaultOn, setDefaultTempOff, setDistanceTokens, setErrorTriggeringExamples, setExamplePair, setGoalSpecific, setIncorrectExamples, setLocQualityIssueType, setMinPrevMatches, setOfficeDefaultOff, setOfficeDefaultOn, setPremium, setTags, setToneTags, setUrl, toRuleMatchArray, useInOffice
public PatternRule(String id, Language language, List<PatternToken> patternTokens, String description, String message, String shortMessage, String suggestionsOutMsg)
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)
public PatternRule(String id, Language language, List<PatternToken> patternTokens, String description, String message, String shortMessage, String suggestionsOutMsg, boolean isMember)
public int estimateContextForSureMatch()
Rule
-1
when the sentence needs to end to be sure there's a match.estimateContextForSureMatch
in class Rule
public final String toPatternString()
public final String toXML()
public RuleMatch[] match(AnalyzedSentence sentence) throws IOException
Rule
match
in class AbstractPatternRule
sentence
- a pre-analyzed sentenceRuleMatch
objectsIOException
public String getShortMessage()