public class GermanSpellerRule extends CompoundAwareHunspellRule
| Modifier and Type | Field and Description |
|---|---|
static String |
RULE_ID |
FILE_EXTENSION, hunspell, nonWordPatternCUSTOM_SPELLING_FILE, GLOBAL_SPELLING_FILE, HIGH_CONFIDENCE, ignoreWordsWithLength, language, languageModel, LANGUAGETOOL, LANGUAGETOOLER, wordListLoader, wordsToBeIgnored| Constructor and Description |
|---|
GermanSpellerRule(ResourceBundle messages,
German language) |
GermanSpellerRule(ResourceBundle messages,
German language,
UserConfig userConfig,
String languageVariantPlainTextDict) |
GermanSpellerRule(ResourceBundle messages,
German language,
UserConfig userConfig,
String languageVariantPlainTextDict,
List<Language> altLanguages,
LanguageModel languageModel) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
acceptSuggestion(String s) |
protected void |
addIgnoreWords(String origLine) |
protected void |
addProhibitedWords(List<String> words) |
protected RuleMatch |
createWrongSplitMatch(AnalyzedSentence sentence,
List<RuleMatch> ruleMatchesSoFar,
int pos,
String coveredWord,
String suggestion1,
String suggestion2,
int prevPos) |
protected List<String> |
expandLine(String line)
Expand suffixes in a line.
|
protected void |
filterForLanguage(List<String> suggestions) |
protected List<SuggestedReplacement> |
filterNoSuggestWords(List<SuggestedReplacement> l) |
protected List<SuggestedReplacement> |
getAdditionalTopSuggestions(List<SuggestedReplacement> suggestions,
String word)
Get additional suggestions added before other suggestions (note the rule may choose to
re-order the suggestions anyway).
|
List<String> |
getCandidates(String word)
Find potential corrections - it's okay if some of these are not valid words,
this list will be filtered against the spellchecker before being returned to the user.
|
protected List<String> |
getFilteredSuggestions(List<String> wordsOrPhrases) |
String |
getId()
A string used to identify the rule in e.g. configuration files.
|
protected List<SuggestedReplacement> |
getOnlySuggestions(String word)
Get suggestions that will replace all other suggestions.
|
protected static MorfologikMultiSpeller |
getSpeller(Language language,
UserConfig userConfig,
String languageVariantPlainTextDict) |
protected static List<String> |
getSpellingFilePaths(String langCode) |
List<String> |
getSuggestions(String word)
As a hunspell-based approach is too slow, we use Morfologik to create suggestions.
|
protected boolean |
ignorePotentiallyMisspelledWord(String word)
Like
SpellingCheckRule.ignoreWord(String), but will only be called after the standard spell
check has run and considered this word to be incorrect. |
protected boolean |
ignoreWord(List<String> words,
int idx)
Returns true iff the word at the given position should be ignored by the spell checker.
|
protected void |
init() |
protected boolean |
isIgnoredNoCase(String word) |
boolean |
isMisspelled(String word) |
protected boolean |
isProhibited(String word)
Whether the word is prohibited, i.e. whether it should be marked as a spelling
error even if the spell checker would accept it.
|
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) |
getCandidates, getStreamsensureInitialized, getActiveChecks, getDescription, getDictFilenameInResources, getSentenceTextWithoutUrlsAndImmunizedTokens, isInIgnoredSet, tokenizeTextacceptPhrases, addIgnoreTokens, addSuggestionsToRuleMatch, filterDupes, filterSuggestions, getAdditionalProhibitFileNames, getAdditionalSpellingFileNames, getAdditionalSuggestions, getAntiPatterns, getIgnoreFileName, getLanguageVariantSpellingFileName, getProhibitFileName, getSpellingFileName, ignoreToken, ignoreWord, isDictionaryBasedSpellingRule, isEMail, isLatinScript, 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
public GermanSpellerRule(ResourceBundle messages, German language)
public GermanSpellerRule(ResourceBundle messages, German language, UserConfig userConfig, String languageVariantPlainTextDict)
public GermanSpellerRule(ResourceBundle messages, German language, UserConfig userConfig, String languageVariantPlainTextDict, List<Language> altLanguages, LanguageModel languageModel)
public RuleMatch[] match(AnalyzedSentence sentence) throws IOException
Rulematch in class HunspellRulesentence - a pre-analyzed sentenceRuleMatch objectsIOExceptionprotected void init()
throws IOException
init in class HunspellRuleIOExceptionpublic String getId()
RuleA-Z
and the underscore.getId in class HunspellRuleprotected boolean isIgnoredNoCase(String word)
isIgnoredNoCase in class SpellingCheckRulepublic List<String> getCandidates(String word)
CompoundAwareHunspellRulegetCandidates in class CompoundAwareHunspellRuleprotected boolean isProhibited(String word)
SpellingCheckRuleisProhibited in class SpellingCheckRuleprotected void addIgnoreWords(String origLine)
addIgnoreWords in class SpellingCheckRuleorigLine - the line as read from spelling.txt.protected List<String> expandLine(String line)
SpellingCheckRulebicycle/S into [bicycle, bicycles].expandLine in class SpellingCheckRuleprotected RuleMatch createWrongSplitMatch(AnalyzedSentence sentence, List<RuleMatch> ruleMatchesSoFar, int pos, String coveredWord, String suggestion1, String suggestion2, int prevPos)
createWrongSplitMatch in class SpellingCheckRulepublic List<String> getSuggestions(String word) throws IOException
CompoundAwareHunspellRulegetSuggestions in class CompoundAwareHunspellRuleIOExceptionprotected boolean acceptSuggestion(String s)
acceptSuggestion in class HunspellRule@Nullable protected static MorfologikMultiSpeller getSpeller(Language language, UserConfig userConfig, String languageVariantPlainTextDict)
protected void filterForLanguage(List<String> suggestions)
filterForLanguage in class CompoundAwareHunspellRuleprotected List<String> sortSuggestionByQuality(String misspelling, List<String> suggestions)
sortSuggestionByQuality in class CompoundAwareHunspellRuleprotected List<String> getFilteredSuggestions(List<String> wordsOrPhrases)
getFilteredSuggestions in class CompoundAwareHunspellRulepublic boolean isMisspelled(String word)
isMisspelled in class HunspellRuleprotected boolean ignoreWord(List<String> words, int idx) throws IOException
SpellingCheckRuleSpellingCheckRule.ignoreToken(AnalyzedTokenReadings[], int) instead.ignoreWord in class SpellingCheckRuleIOExceptionprotected boolean ignorePotentiallyMisspelledWord(String word) throws IOException
SpellingCheckRuleSpellingCheckRule.ignoreWord(String), but will only be called after the standard spell
check has run and considered this word to be incorrect. This way, tests run here
can be a bit more computationally expensive.ignorePotentiallyMisspelledWord in class SpellingCheckRuleIOExceptionprotected List<SuggestedReplacement> getAdditionalTopSuggestions(List<SuggestedReplacement> suggestions, String word) throws IOException
SpellingCheckRulegetAdditionalTopSuggestions in class SpellingCheckRuleIOExceptionprotected boolean isQuotedCompound(AnalyzedSentence analyzedSentence, int idx, String token)
HunspellRuleisQuotedCompound in class HunspellRuleprotected void addProhibitedWords(List<String> words)
addProhibitedWords in class SpellingCheckRulewords - list of words to be prohibited.protected List<SuggestedReplacement> filterNoSuggestWords(List<SuggestedReplacement> l)
filterNoSuggestWords in class SpellingCheckRuleprotected List<SuggestedReplacement> getOnlySuggestions(String word)
SpellingCheckRulegetOnlySuggestions in class SpellingCheckRule