public abstract class MorfologikSpellerRule extends SpellingCheckRule
Modifier and Type | Field and Description |
---|---|
protected Locale |
conversionLocale |
protected GlobalConfig |
globalConfig |
protected Language |
motherTongue |
protected MorfologikMultiSpeller |
speller1 |
protected MorfologikMultiSpeller |
speller2 |
protected MorfologikMultiSpeller |
speller3 |
CUSTOM_SPELLING_FILE, GLOBAL_SPELLING_FILE, HIGH_CONFIDENCE, ignoreWordsWithLength, language, languageModel, LANGUAGETOOL, LANGUAGETOOLER, MAX_TOKEN_LENGTH, wordListLoader, wordsToBeIgnored
Constructor and Description |
---|
MorfologikSpellerRule(ResourceBundle messages,
Language language) |
MorfologikSpellerRule(ResourceBundle messages,
Language language,
GlobalConfig globalConfig,
UserConfig userConfig,
List<Language> altLanguages,
LanguageModel languageModel,
Language motherTongue) |
MorfologikSpellerRule(ResourceBundle messages,
Language language,
UserConfig userConfig) |
MorfologikSpellerRule(ResourceBundle messages,
Language language,
UserConfig userConfig,
List<Language> altLanguages) |
Modifier and Type | Method and Description |
---|---|
String |
getDescription()
A short description of the error this rule can detect, usually in the language of the text
that is checked.
|
abstract String |
getFileName()
Get the filename, e.g., /resource/pl/spelling.dict.
|
abstract String |
getId()
A string used to identify the rule in e.g. configuration files.
|
protected List<RuleMatch> |
getRuleMatches(String word,
int startPos,
AnalyzedSentence sentence,
List<RuleMatch> ruleMatchesSoFar,
int idx,
AnalyzedTokenReadings[] tokens) |
List<String> |
getSpellingSuggestions(String w) |
protected Translator |
getTranslator(GlobalConfig globalConfig) |
protected boolean |
ignoreWord(String word)
Ignore surrogate pairs (emojis)
|
protected static boolean |
isEmoji(String word)
Checks whether a given String is an Emoji with a string length larger 1.
|
protected boolean |
isMisspelled(MorfologikMultiSpeller speller,
String word) |
boolean |
isMisspelled(String word) |
RuleMatch[] |
match(AnalyzedSentence sentence)
Check whether the given sentence matches this error rule, i.e. whether it
contains the error detected by this rule.
|
protected List<SuggestedReplacement> |
orderSuggestions(List<SuggestedReplacement> suggestions,
String word) |
protected void |
setCheckCompound(boolean checkCompound) |
protected void |
setCompoundRegex(String compoundRegex) |
void |
setIgnoreTaggedWords()
Skip words that are known in the POS tagging dictionary, assuming they
cannot be incorrect.
|
void |
setLocale(Locale locale) |
Pattern |
tokenizingPattern()
Get the regular expression pattern used to tokenize
the words as in the source dictionary.
|
acceptPhrases, addIgnoreTokens, addIgnoreWords, addProhibitedWords, addSuggestionsToRuleMatch, createWrongSplitMatch, expandLine, filterDupes, filterNoSuggestWords, filterSuggestions, getAdditionalProhibitFileNames, getAdditionalSpellingFileNames, getAdditionalSuggestions, getAdditionalTopSuggestions, getAntiPatterns, getIgnoreFileName, getLanguageVariantSpellingFileName, getOnlySuggestions, getProhibitFileName, getSpellingFileName, ignorePotentiallyMisspelledWord, ignoreToken, ignoreWord, init, isDictionaryBasedSpellingRule, isEMail, isIgnoredNoCase, isInIgnoredSet, isLatinScript, isProhibited, isUrl, setConsiderIgnoreWords, setConvertsCase, startsWithIgnoredWord, tokenizeNewWords
addExamplePair, addTags, addToneTags, cacheAntiPatterns, estimateContextForSureMatch, getCategory, getConfigureText, getCorrectExamples, getDefaultValue, getDistanceTokens, getErrorTriggeringExamples, getFullId, getIncorrectExamples, getLocQualityIssueType, getMaxConfigurableValue, getMinConfigurableValue, getMinPrevMatches, getSentenceWithImmunization, getSourceFile, getSubId, getTags, getToneTags, getUrl, hasConfigurableValue, hasTag, hasToneTag, isDefaultOff, isDefaultTempOff, 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 MorfologikMultiSpeller speller1
protected MorfologikMultiSpeller speller2
protected MorfologikMultiSpeller speller3
protected Locale conversionLocale
protected final Language motherTongue
protected final GlobalConfig globalConfig
public MorfologikSpellerRule(ResourceBundle messages, Language language) throws IOException
IOException
public MorfologikSpellerRule(ResourceBundle messages, Language language, UserConfig userConfig) throws IOException
IOException
public MorfologikSpellerRule(ResourceBundle messages, Language language, UserConfig userConfig, List<Language> altLanguages) throws IOException
IOException
public MorfologikSpellerRule(ResourceBundle messages, Language language, GlobalConfig globalConfig, UserConfig userConfig, List<Language> altLanguages, LanguageModel languageModel, Language motherTongue) throws IOException
IOException
public abstract String getFileName()
public abstract String getId()
Rule
A-Z
and the underscore.getId
in class SpellingCheckRule
public String getDescription()
Rule
getDescription
in class SpellingCheckRule
public void setLocale(Locale locale)
public void setIgnoreTaggedWords()
public RuleMatch[] match(AnalyzedSentence sentence) throws IOException
Rule
match
in class SpellingCheckRule
sentence
- a pre-analyzed sentenceRuleMatch
objectsIOException
@Nullable protected Translator getTranslator(GlobalConfig globalConfig)
@Experimental public boolean isMisspelled(String word) throws IOException
isMisspelled
in class SpellingCheckRule
IOException
protected boolean isMisspelled(MorfologikMultiSpeller speller, String word)
protected List<RuleMatch> getRuleMatches(String word, int startPos, AnalyzedSentence sentence, List<RuleMatch> ruleMatchesSoFar, int idx, AnalyzedTokenReadings[] tokens) throws IOException
IOException
@Nullable public Pattern tokenizingPattern()
Pattern
that is used to tokenize words or null
.protected List<SuggestedReplacement> orderSuggestions(List<SuggestedReplacement> suggestions, String word)
protected void setCheckCompound(boolean checkCompound)
checkCompound
- If true and the word is not in the dictionary
it will be split (see setCompoundRegex(String)
)
and each component will be checked separatelyprotected void setCompoundRegex(String compoundRegex)
compoundRegex
- see setCheckCompound(boolean)
protected static boolean isEmoji(String word)
word
- to be checkedprotected boolean ignoreWord(String word) throws IOException
ignoreWord
in class SpellingCheckRule
IOException
SpellingCheckRule.ignoreWord(java.lang.String)
public List<String> getSpellingSuggestions(String w) throws IOException
IOException