public class GermanSpellerRule extends CompoundAwareHunspellRule
Modifier and Type | Field and Description |
---|---|
static String |
RULE_ID |
FILE_EXTENSION, hunspell, nonWordPattern
CUSTOM_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, getStreams
ensureInitialized, getActiveChecks, getDescription, getDictFilenameInResources, getSentenceTextWithoutUrlsAndImmunizedTokens, isInIgnoredSet, tokenizeText
acceptPhrases, addIgnoreTokens, addSuggestionsToRuleMatch, filterDupes, filterSuggestions, getAdditionalProhibitFileNames, getAdditionalSpellingFileNames, getAdditionalSuggestions, getAntiPatterns, getIgnoreFileName, getLanguageVariantSpellingFileName, getProhibitFileName, getSpellingFileName, ignoreToken, ignoreWord, isDictionaryBasedSpellingRule, isEMail, isLatinScript, 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
public 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
Rule
match
in class HunspellRule
sentence
- a pre-analyzed sentenceRuleMatch
objectsIOException
protected void init() throws IOException
init
in class HunspellRule
IOException
public String getId()
Rule
A-Z
and the underscore.getId
in class HunspellRule
protected boolean isIgnoredNoCase(String word)
isIgnoredNoCase
in class SpellingCheckRule
public List<String> getCandidates(String word)
CompoundAwareHunspellRule
getCandidates
in class CompoundAwareHunspellRule
protected boolean isProhibited(String word)
SpellingCheckRule
isProhibited
in class SpellingCheckRule
protected void addIgnoreWords(String origLine)
addIgnoreWords
in class SpellingCheckRule
origLine
- the line as read from spelling.txt
.protected List<String> expandLine(String line)
SpellingCheckRule
bicycle/S
into [bicycle, bicycles]
.expandLine
in class SpellingCheckRule
protected RuleMatch createWrongSplitMatch(AnalyzedSentence sentence, List<RuleMatch> ruleMatchesSoFar, int pos, String coveredWord, String suggestion1, String suggestion2, int prevPos)
createWrongSplitMatch
in class SpellingCheckRule
public List<String> getSuggestions(String word) throws IOException
CompoundAwareHunspellRule
getSuggestions
in class CompoundAwareHunspellRule
IOException
protected 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 CompoundAwareHunspellRule
protected List<String> sortSuggestionByQuality(String misspelling, List<String> suggestions)
sortSuggestionByQuality
in class CompoundAwareHunspellRule
protected List<String> getFilteredSuggestions(List<String> wordsOrPhrases)
getFilteredSuggestions
in class CompoundAwareHunspellRule
public boolean isMisspelled(String word)
isMisspelled
in class HunspellRule
protected boolean ignoreWord(List<String> words, int idx) throws IOException
SpellingCheckRule
SpellingCheckRule.ignoreToken(AnalyzedTokenReadings[], int)
instead.ignoreWord
in class SpellingCheckRule
IOException
protected boolean ignorePotentiallyMisspelledWord(String word) throws IOException
SpellingCheckRule
SpellingCheckRule.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 SpellingCheckRule
IOException
protected List<SuggestedReplacement> getAdditionalTopSuggestions(List<SuggestedReplacement> suggestions, String word) throws IOException
SpellingCheckRule
getAdditionalTopSuggestions
in class SpellingCheckRule
IOException
protected boolean isQuotedCompound(AnalyzedSentence analyzedSentence, int idx, String token)
HunspellRule
isQuotedCompound
in class HunspellRule
protected void addProhibitedWords(List<String> words)
addProhibitedWords
in class SpellingCheckRule
words
- list of words to be prohibited.protected List<SuggestedReplacement> filterNoSuggestWords(List<SuggestedReplacement> l)
filterNoSuggestWords
in class SpellingCheckRule
protected List<SuggestedReplacement> getOnlySuggestions(String word)
SpellingCheckRule
getOnlySuggestions
in class SpellingCheckRule