Class ProhibitedCompoundRule
java.lang.Object
org.languagetool.rules.Rule
org.languagetool.rules.de.ProhibitedCompoundRule
public class ProhibitedCompoundRule
extends org.languagetool.rules.Rule
Find compounds that might be morphologically correct but are still probably wrong, like 'Lehrzeile'.
- Since:
- 4.1
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.hankcs.algorithm.AhoCorasickDoubleArrayTrie<String> private ProhibitedCompoundRule.Pairprivate final org.languagetool.languagemodel.BaseLanguageModelprivate static final List<ProhibitedCompoundRule.Pair> protected Map<String, List<ProhibitedCompoundRule.Pair>> private static final Map<String, List<ProhibitedCompoundRule.Pair>> private static final com.hankcs.algorithm.AhoCorasickDoubleArrayTrie<String> static final Stringprivate static final GermanSpellerRuleFields inherited from class org.languagetool.rules.Rule
messages -
Constructor Summary
ConstructorsConstructorDescriptionProhibitedCompoundRule(ResourceBundle messages, org.languagetool.languagemodel.LanguageModel lm) -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidaddAllCaseVariants(List<ProhibitedCompoundRule.Pair> candidatePairs, ProhibitedCompoundRule.Pair lcPair) protected static voidaddItemsFromConfusionSets(List<ProhibitedCompoundRule.Pair> pairs, String confusionSetsFile, boolean isUpperCase) private static voidgetId()org.languagetool.rules.RuleMatch[]match(org.languagetool.AnalyzedSentence sentence) voidsetConfusionPair(ProhibitedCompoundRule.Pair confusionPair) ignore automatically loaded pairs and only match using given confusionPair used for evaluation by ProhibitedCompoundRuleEvaluatorprotected static com.hankcs.algorithm.AhoCorasickDoubleArrayTrie<String> setupAhoCorasickSearch(List<ProhibitedCompoundRule.Pair> pairs, Map<String, List<ProhibitedCompoundRule.Pair>> pairMap) Methods inherited from class org.languagetool.rules.Rule
addExamplePair, estimateContextForSureMatch, getAntiPatterns, getCategory, getConfigureText, getCorrectExamples, getDefaultValue, getErrorTriggeringExamples, 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
-
Field Details
-
RULE_ID
- Since:
- 4.3
- See Also:
-
lowercasePairs
-
spellerRule
-
ignoreWords
-
blacklist
-
ahoCorasickDoubleArrayTrie
-
pairMap
-
prohibitedCompoundRuleSearcher
private static final com.hankcs.algorithm.AhoCorasickDoubleArrayTrie<String> prohibitedCompoundRuleSearcher -
prohibitedCompoundRulePairMap
-
lm
private final org.languagetool.languagemodel.BaseLanguageModel lm -
confusionPair
-
-
Constructor Details
-
ProhibitedCompoundRule
public ProhibitedCompoundRule(ResourceBundle messages, org.languagetool.languagemodel.LanguageModel lm)
-
-
Method Details
-
addAllCaseVariants
private static void addAllCaseVariants(List<ProhibitedCompoundRule.Pair> candidatePairs, ProhibitedCompoundRule.Pair lcPair) -
addUpperCaseVariants
-
addItemsFromConfusionSets
protected static void addItemsFromConfusionSets(List<ProhibitedCompoundRule.Pair> pairs, String confusionSetsFile, boolean isUpperCase) -
setupAhoCorasickSearch
protected static com.hankcs.algorithm.AhoCorasickDoubleArrayTrie<String> setupAhoCorasickSearch(List<ProhibitedCompoundRule.Pair> pairs, Map<String, List<ProhibitedCompoundRule.Pair>> pairMap) -
getId
- Specified by:
getIdin classorg.languagetool.rules.Rule
-
getDescription
- Specified by:
getDescriptionin classorg.languagetool.rules.Rule
-
match
public org.languagetool.rules.RuleMatch[] match(org.languagetool.AnalyzedSentence sentence) throws IOException - Specified by:
matchin classorg.languagetool.rules.Rule- Throws:
IOException
-
setConfusionPair
ignore automatically loaded pairs and only match using given confusionPair used for evaluation by ProhibitedCompoundRuleEvaluator- Parameters:
confusionPair- pair to evaluate, parts are assumed to be lowercase / null to reset
-