Package org.languagetool.rules
Class AbstractWordCoherencyRule
- java.lang.Object
-
- org.languagetool.rules.Rule
-
- org.languagetool.rules.TextLevelRule
-
- org.languagetool.rules.AbstractWordCoherencyRule
-
public abstract class AbstractWordCoherencyRule extends TextLevelRule
A rule that matches words for which two different spellings are used throughout the document.Note that this should not be used for language variations like American English vs. British English or German "alte Rechtschreibung" vs. "neue Rechtschreibung" -- that's the task of a spell checker.
- Since:
- 2.7
-
-
Constructor Summary
Constructors Constructor Description AbstractWordCoherencyRule(java.util.ResourceBundle messages)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract java.lang.String
getMessage(java.lang.String word1, java.lang.String word2)
Get the message shown to the user if the rule matches.protected abstract java.util.Map<java.lang.String,java.util.Set<java.lang.String>>
getWordMap()
Maps words in both directions, e.g.RuleMatch[]
match(java.util.List<AnalyzedSentence> sentences)
int
minToCheckParagraph()
Gives back the minimum number of paragraphs to check to give back a correct result.-
Methods inherited from class org.languagetool.rules.TextLevelRule
estimateContextForSureMatch, match, match
-
Methods inherited from class org.languagetool.rules.Rule
addExamplePair, getAntiPatterns, getCategory, getConfigureText, getCorrectExamples, getDefaultValue, getDescription, getErrorTriggeringExamples, getId, getIncorrectExamples, getLocQualityIssueType, getMaxConfigurableValue, getMinConfigurableValue, getSentenceWithImmunization, getUrl, hasConfigurableValue, isDefaultOff, isDefaultTempOff, isDictionaryBasedSpellingRule, isOfficeDefaultOff, isOfficeDefaultOn, makeAntiPatterns, setCategory, setCorrectExamples, setDefaultOff, setDefaultOn, setDefaultTempOff, setErrorTriggeringExamples, setIncorrectExamples, setLocQualityIssueType, setOfficeDefaultOff, setOfficeDefaultOn, setUrl, supportsLanguage, toRuleMatchArray, useInOffice
-
-
-
-
Method Detail
-
getWordMap
protected abstract java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getWordMap()
Maps words in both directions, e.g. "aufwendig -> aufwändig" and "aufwändig -> aufwendig".- Since:
- 3.0
-
getMessage
protected abstract java.lang.String getMessage(java.lang.String word1, java.lang.String word2)
Get the message shown to the user if the rule matches.
-
match
public RuleMatch[] match(java.util.List<AnalyzedSentence> sentences)
- Specified by:
match
in classTextLevelRule
-
minToCheckParagraph
public int minToCheckParagraph()
Description copied from class:TextLevelRule
Gives back the minimum number of paragraphs to check to give back a correct result. Only used by LO office extension.- n == -1 --> need to check full text (use only if really needed / bad performance) examples: AbstractWordCoherencyRule, GenericUnpairedBracketsRule, ...
- n == 0 --> need only to check the current paragraph examples: MultipleWhitespaceRule, LongParagraphRule, ...
- n >= 1 --> need only to check n paragraphs around the current paragraph examples: ParagraphRepeatBeginningRule (n == 1), WordRepeatBeginningRule (n == 2), ...
- Specified by:
minToCheckParagraph
in classTextLevelRule
-
-