Package org.languagetool.rules.de
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.Pair
private final org.languagetool.languagemodel.BaseLanguageModel
private 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 String
private static final GermanSpellerRule
Fields inherited from class org.languagetool.rules.Rule
messages
-
Constructor Summary
ConstructorsConstructorDescriptionProhibitedCompoundRule
(ResourceBundle messages, org.languagetool.languagemodel.LanguageModel lm) -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
addAllCaseVariants
(List<ProhibitedCompoundRule.Pair> candidatePairs, ProhibitedCompoundRule.Pair lcPair) protected static void
addItemsFromConfusionSets
(List<ProhibitedCompoundRule.Pair> pairs, String confusionSetsFile, boolean isUpperCase) private static void
getId()
org.languagetool.rules.RuleMatch[]
match
(org.languagetool.AnalyzedSentence sentence) void
setConfusionPair
(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:
getId
in classorg.languagetool.rules.Rule
-
getDescription
- Specified by:
getDescription
in classorg.languagetool.rules.Rule
-
match
public org.languagetool.rules.RuleMatch[] match(org.languagetool.AnalyzedSentence sentence) throws IOException - Specified by:
match
in 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
-