public class ProhibitedCompoundRule extends Rule
Modifier and Type | Class and Description |
---|---|
static class |
ProhibitedCompoundRule.Pair |
Modifier and Type | Field and Description |
---|---|
protected com.hankcs.algorithm.AhoCorasickDoubleArrayTrie<String> |
ahoCorasickDoubleArrayTrie |
protected Map<String,List<ProhibitedCompoundRule.Pair>> |
pairMap |
static String |
RULE_ID
Deprecated.
each pair has its own id since LT 5.1
|
Constructor and Description |
---|
ProhibitedCompoundRule(ResourceBundle messages,
LanguageModel lm,
UserConfig userConfig,
Language language) |
Modifier and Type | Method and Description |
---|---|
protected static void |
addItemsFromConfusionSets(List<ProhibitedCompoundRule.Pair> pairs,
String confusionSetsFile,
boolean isUpperCase) |
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.
|
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 |
setConfusionPair(ProhibitedCompoundRule.Pair confusionPair)
ignore automatically loaded pairs and only match using given confusionPair
used for evaluation by ProhibitedCompoundRuleEvaluator
|
protected static com.hankcs.algorithm.AhoCorasickDoubleArrayTrie<String> |
setupAhoCorasickSearch(List<ProhibitedCompoundRule.Pair> pairs,
Map<String,List<ProhibitedCompoundRule.Pair>> pairMap) |
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
public static final String RULE_ID
protected com.hankcs.algorithm.AhoCorasickDoubleArrayTrie<String> ahoCorasickDoubleArrayTrie
protected Map<String,List<ProhibitedCompoundRule.Pair>> pairMap
public ProhibitedCompoundRule(ResourceBundle messages, LanguageModel lm, UserConfig userConfig, Language language)
protected static void addItemsFromConfusionSets(List<ProhibitedCompoundRule.Pair> pairs, String confusionSetsFile, boolean isUpperCase)
protected static com.hankcs.algorithm.AhoCorasickDoubleArrayTrie<String> setupAhoCorasickSearch(List<ProhibitedCompoundRule.Pair> pairs, Map<String,List<ProhibitedCompoundRule.Pair>> pairMap)
public String getId()
Rule
A-Z
and the underscore.public String getDescription()
Rule
getDescription
in class Rule
public RuleMatch[] match(AnalyzedSentence sentence) throws IOException
Rule
match
in class Rule
sentence
- a pre-analyzed sentenceRuleMatch
objectsIOException
public void setConfusionPair(ProhibitedCompoundRule.Pair confusionPair)
confusionPair
- pair to evaluate, parts are assumed to be lowercase / null to reset