public class HunspellRule extends SpellingCheckRule
| Modifier and Type | Field and Description |
|---|---|
protected static String |
FILE_EXTENSION |
protected HunspellDictionary |
hunspell |
protected Pattern |
nonWordPattern |
static String |
RULE_ID |
CUSTOM_SPELLING_FILE, GLOBAL_SPELLING_FILE, HIGH_CONFIDENCE, ignoreWordsWithLength, language, languageModel, LANGUAGETOOL, LANGUAGETOOLER, MAX_TOKEN_LENGTH, wordListLoader, wordsToBeIgnored| Constructor and Description |
|---|
HunspellRule(ResourceBundle messages,
Language language,
UserConfig userConfig) |
HunspellRule(ResourceBundle messages,
Language language,
UserConfig userConfig,
List<Language> altLanguages) |
HunspellRule(ResourceBundle messages,
Language language,
UserConfig userConfig,
List<Language> altLanguages,
LanguageModel languageModel) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
acceptSuggestion(String suggestion) |
protected void |
ensureInitialized() |
static Queue<String> |
getActiveChecks() |
String |
getDescription()
A short description of the error this rule can detect, usually in the language of the text
that is checked.
|
protected String |
getDictFilenameInResources(String langCountry) |
String |
getId()
A string used to identify the rule in e.g. configuration files.
|
protected String |
getSentenceTextWithoutUrlsAndImmunizedTokens(AnalyzedSentence sentence) |
List<String> |
getSuggestions(String word) |
protected void |
init() |
protected boolean |
isInIgnoredSet(String word) |
boolean |
isMisspelled(String word) |
protected boolean |
isQuotedCompound(AnalyzedSentence analyzedSentence,
int idx,
String token)
Is the given token part of a hyphenated compound preceded by a quoted token (e.g., „Spiegel“-Magazin)
and should be treated as an ordinary hyphenated compound (e.g., „Spiegel-Magazin“)
|
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<String> |
sortSuggestionByQuality(String misspelling,
List<String> suggestions) |
protected String[] |
tokenizeText(String sentence) |
acceptPhrases, addIgnoreTokens, addIgnoreWords, addProhibitedWords, addSuggestionsToRuleMatch, createWrongSplitMatch, expandLine, filterDupes, filterNoSuggestWords, filterSuggestions, getAdditionalProhibitFileNames, getAdditionalSpellingFileNames, getAdditionalSuggestions, getAdditionalTopSuggestions, getAntiPatterns, getIgnoreFileName, getLanguageVariantSpellingFileName, getOnlySuggestions, getProhibitFileName, getSpellingFileName, ignorePotentiallyMisspelledWord, ignoreToken, ignoreWord, ignoreWord, isDictionaryBasedSpellingRule, isEMail, isIgnoredNoCase, isLatinScript, isProhibited, isUrl, setConsiderIgnoreWords, setConvertsCase, startsWithIgnoredWord, tokenizeNewWordsaddExamplePair, 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, useInOfficepublic static final String RULE_ID
protected static final String FILE_EXTENSION
protected volatile HunspellDictionary hunspell
protected Pattern nonWordPattern
public HunspellRule(ResourceBundle messages, Language language, UserConfig userConfig)
public HunspellRule(ResourceBundle messages, Language language, UserConfig userConfig, List<Language> altLanguages)
public HunspellRule(ResourceBundle messages, Language language, UserConfig userConfig, List<Language> altLanguages, LanguageModel languageModel)
public String getId()
RuleA-Z
and the underscore.getId in class SpellingCheckRulepublic String getDescription()
RulegetDescription in class SpellingCheckRuleprotected boolean isQuotedCompound(AnalyzedSentence analyzedSentence, int idx, String token)
public RuleMatch[] match(AnalyzedSentence sentence) throws IOException
Rulematch in class SpellingCheckRulesentence - a pre-analyzed sentenceRuleMatch objectsIOExceptionprotected boolean acceptSuggestion(String suggestion)
public boolean isMisspelled(String word)
isMisspelled in class SpellingCheckRulepublic List<String> getSuggestions(String word) throws IOException
IOExceptionprotected List<String> sortSuggestionByQuality(String misspelling, List<String> suggestions)
protected String getSentenceTextWithoutUrlsAndImmunizedTokens(AnalyzedSentence sentence)
protected final void ensureInitialized()
throws IOException
IOExceptionprotected void init()
throws IOException
init in class SpellingCheckRuleIOExceptionprotected boolean isInIgnoredSet(String word)
isInIgnoredSet in class SpellingCheckRule