public abstract class AbstractSimpleReplaceRule extends Rule
rules/XX/replace.txt
, where XX is a code of the language.Modifier and Type | Field and Description |
---|---|
protected boolean |
ignoreTaggedWords |
protected boolean |
subRuleSpecificIds |
Constructor and Description |
---|
AbstractSimpleReplaceRule(ResourceBundle messages,
Language language) |
Modifier and Type | Method and Description |
---|---|
protected RuleMatch |
createRuleMatch(AnalyzedTokenReadings tokenReadings,
List<String> replacements,
AnalyzedSentence sentence,
String originalTokenStr) |
protected List<RuleMatch> |
findMatches(AnalyzedTokenReadings tokenReadings,
AnalyzedSentence sentence) |
String |
getDescription()
A short description of the error this rule can detect, usually in the language of the text
that is checked.
|
String |
getId()
A string used to identify the rule in e.g. configuration files.
|
Locale |
getLocale() |
String |
getMessage(String tokenStr,
List<String> replacements) |
String |
getShort() |
Synthesizer |
getSynthesizer()
Synthesizer to generate inflected suggestions
|
abstract Map<String,List<String>> |
getWrongWords() |
boolean |
isCaseSensitive()
Indicates if the rule is case-sensitive.
|
boolean |
isCheckLemmas() |
protected boolean |
isTagged(AnalyzedTokenReadings tokenReadings)
This method allows to override which tags will mark token as tagged
|
protected boolean |
isTokenException(AnalyzedTokenReadings atr) |
protected static Map<String,List<String>> |
loadFromPath(String... paths) |
protected static Map<String,List<String>> |
loadFromPath(String path) |
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 |
setCheckLemmas(boolean checkLemmas)
Used to disable matching lemmas.
|
void |
setIgnoreTaggedWords()
Skip words that are known in the POS tagging dictionary, assuming they
cannot be incorrect.
|
void |
useSubRuleSpecificIds()
If this is set, each replacement pair will have its own rule ID, making rule deactivations more specific.
|
addExamplePair, addTags, addToneTags, cacheAntiPatterns, estimateContextForSureMatch, getAntiPatterns, getCategory, getConfigureText, getCorrectExamples, getDefaultValue, getDistanceTokens, getErrorTriggeringExamples, getFullId, getIncorrectExamples, getLocQualityIssueType, getMaxConfigurableValue, getMinConfigurableValue, getMinPrevMatches, getSentenceWithImmunization, getSourceFile, getSubId, 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, supportsLanguage, toRuleMatchArray, useInOffice
protected boolean ignoreTaggedWords
protected boolean subRuleSpecificIds
public AbstractSimpleReplaceRule(ResourceBundle messages, Language language)
public boolean isCaseSensitive()
true
.public Locale getLocale()
isCaseSensitive()
is set to false
.public void setIgnoreTaggedWords()
public String getId()
Rule
A-Z
and the underscore.public String getDescription()
Rule
getDescription
in class Rule
public String getShort()
public RuleMatch[] match(AnalyzedSentence sentence) throws IOException
Rule
match
in class Rule
sentence
- a pre-analyzed sentenceRuleMatch
objectsIOException
protected List<RuleMatch> findMatches(AnalyzedTokenReadings tokenReadings, AnalyzedSentence sentence) throws IOException
IOException
protected boolean isTagged(AnalyzedTokenReadings tokenReadings)
protected RuleMatch createRuleMatch(AnalyzedTokenReadings tokenReadings, List<String> replacements, AnalyzedSentence sentence, String originalTokenStr)
public boolean isCheckLemmas()
public void setCheckLemmas(boolean checkLemmas)
@Nullable public Synthesizer getSynthesizer()
protected boolean isTokenException(AnalyzedTokenReadings atr)
public void useSubRuleSpecificIds()