Package org.languagetool.rules.uk
Class SimpleReplaceSoftRule
java.lang.Object
org.languagetool.rules.Rule
org.languagetool.rules.AbstractSimpleReplaceRule
org.languagetool.rules.uk.SimpleReplaceSoftRule
A rule that matches words for which better alternatives exist and suggests them instead.
On top of generic replacement list supports allowed word contexts, e.g.
спасіння=ctx: релігія,поезія|рятування|...
Loads the relevant words from
rules/uk/replace_soft.txt.
TODO: AbstractSimpleReplaceRule loads context as part of suggestion list
and to be able to merge contexts for different lemmas we need to extract context out
of suggestions list on every match. We may need to write our own replacement loader to make it right.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from class org.languagetool.rules.AbstractSimpleReplaceRule
ignoreTaggedWords, subRuleSpecificIds -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static SimpleReplaceSoftRule.ContextReplfindContext(List<String> replacements) A short description of the error this rule can detect, usually in the language of the text that is checked.final StringgetId()A string used to identify the rule in e.g.getMessage(String tokenStr, List<String> replacements) getShort()booleanIndicates if the rule is case-sensitive.protected booleanMethods inherited from class org.languagetool.rules.AbstractSimpleReplaceRule
createRuleMatch, findMatches, getLocale, getSynthesizer, isCheckLemmas, isTagged, loadFromPath, loadFromPath, match, setCheckLemmas, setIgnoreTaggedWords, useSubRuleSpecificIdsMethods inherited from class org.languagetool.rules.Rule
addExamplePair, addTags, addToneTags, cacheAntiPatterns, estimateContextForSureMatch, getAntiPatterns, getCategory, getCorrectExamples, getDistanceTokens, getErrorTriggeringExamples, getFullId, getIncorrectExamples, getLocQualityIssueType, getMinPrevMatches, getPriority, getRuleOptions, getSentenceWithImmunization, getSourceFile, getSubId, getTags, getToneTags, getUrl, hasTag, hasToneTag, isDefaultOff, isDefaultTempOff, isDictionaryBasedSpellingRule, isGoalSpecific, isIncludedInHiddenMatches, isOfficeDefaultOff, isOfficeDefaultOn, isPremium, makeAntiPatterns, setCategory, setCorrectExamples, setDefaultOff, setDefaultOn, setDefaultTempOff, setDistanceTokens, setErrorTriggeringExamples, setExamplePair, setGoalSpecific, setIncludedInHiddenMatches, setIncorrectExamples, setLocQualityIssueType, setMinPrevMatches, setOfficeDefaultOff, setOfficeDefaultOn, setPremium, setPriority, setTags, setToneTags, setUrl, supportsLanguage, toRuleMatchArray, useInOffice
-
Field Details
-
CONTEXT_PREFIX
- See Also:
-
WRONG_WORDS
-
-
Constructor Details
-
SimpleReplaceSoftRule
- Throws:
IOException
-
-
Method Details
-
getWrongWords
- Specified by:
getWrongWordsin classAbstractSimpleReplaceRule
-
getId
Description copied from class:RuleA string used to identify the rule in e.g. configuration files. This string is supposed to be unique and to stay the same in all upcoming versions of LanguageTool. It's supposed to contain only the charactersA-Zand the underscore.- Overrides:
getIdin classAbstractSimpleReplaceRule
-
getDescription
Description copied from class:RuleA short description of the error this rule can detect, usually in the language of the text that is checked.- Overrides:
getDescriptionin classAbstractSimpleReplaceRule
-
getShort
- Overrides:
getShortin classAbstractSimpleReplaceRule
-
getMessage
- Overrides:
getMessagein classAbstractSimpleReplaceRule
-
isTokenException
- Overrides:
isTokenExceptionin classAbstractSimpleReplaceRule
-
isCaseSensitive
public boolean isCaseSensitive()Description copied from class:AbstractSimpleReplaceRuleIndicates if the rule is case-sensitive. Default value istrue.- Overrides:
isCaseSensitivein classAbstractSimpleReplaceRule- Returns:
- true if the rule is case-sensitive, false otherwise.
-
findContext
-