Package org.languagetool.rules.de
Class GermanSpellerRule
- java.lang.Object
-
- org.languagetool.rules.Rule
-
- org.languagetool.rules.spelling.SpellingCheckRule
-
- org.languagetool.rules.spelling.hunspell.HunspellRule
-
- org.languagetool.rules.spelling.hunspell.CompoundAwareHunspellRule
-
- org.languagetool.rules.de.GermanSpellerRule
-
- Direct Known Subclasses:
AustrianGermanSpellerRule,SwissGermanSpellerRule
public class GermanSpellerRule extends org.languagetool.rules.spelling.hunspell.CompoundAwareHunspellRule
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classGermanSpellerRule.ExpandingReader
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Map<java.util.regex.Pattern,java.util.function.Function<java.lang.String,java.util.List<java.lang.String>>>ADDITIONAL_SUGGESTIONSprivate GermanCompoundTokenizercompoundTokenizerprivate LineExpanderlineExpanderprivate static intMAX_EDIT_DISTANCEprivate static java.util.regex.PatternPREVENT_SUGGESTIONstatic java.lang.StringRULE_IDprivate static de.danielnaber.jwordsplitter.GermanWordSplittersplitterprivate org.languagetool.synthesis.Synthesizersynthesizerprivate org.languagetool.tagging.Taggertaggerprivate java.util.Set<java.lang.String>wordEndingsToBeProhibitedprivate java.util.Set<java.lang.String>wordStartsToBeProhibitedprivate java.util.Set<java.lang.String>wordsToBeIgnoredInCompounds-
Fields inherited from class org.languagetool.rules.spelling.hunspell.HunspellRule
FILE_EXTENSION, hunspellDict, needsInit, nonWordPattern, suggestionsOrderer
-
-
Constructor Summary
Constructors Constructor Description GermanSpellerRule(java.util.ResourceBundle messages, German language)GermanSpellerRule(java.util.ResourceBundle messages, German language, org.languagetool.UserConfig userConfig, java.lang.String languageVariantPlainTextDict)GermanSpellerRule(java.util.ResourceBundle messages, German language, org.languagetool.UserConfig userConfig, java.lang.String languageVariantPlainTextDict, java.util.List<org.languagetool.Language> altLanguages, org.languagetool.languagemodel.LanguageModel languageModel)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddIgnoreWords(java.lang.String origLine)protected voidaddProhibitedWords(java.util.List<java.lang.String> words)private @Nullable java.lang.StringbaseForThirdPersonSingularVerb(java.lang.String word)protected java.util.List<java.lang.String>expandLine(java.lang.String line)protected voidfilterForLanguage(java.util.List<java.lang.String> suggestions)private java.lang.StringgetAbbreviationSuggestion(java.lang.String word)protected java.util.List<java.lang.String>getAdditionalTopSuggestions(java.util.List<java.lang.String> suggestions, java.lang.String word)java.util.List<java.lang.String>getCandidates(java.lang.String word)protected java.util.List<java.lang.String>getFilteredSuggestions(java.util.List<java.lang.String> wordsOrPhrases)java.lang.StringgetId()private @Nullable java.lang.StringgetParticipleForBaseform(java.lang.String baseform)private @Nullable java.lang.StringgetParticipleSuggestion(java.lang.String word)private @Nullable java.lang.StringgetPastTenseVerbSuggestion(java.lang.String word)private static @Nullable org.languagetool.rules.spelling.morfologik.MorfologikMultiSpellergetSpeller(org.languagetool.Language language, org.languagetool.UserConfig userConfig, java.lang.String languageVariantPlainTextDict)private static de.danielnaber.jwordsplitter.GermanWordSplittergetSplitter()java.util.List<java.lang.String>getSuggestions(java.lang.String word)private @Nullable java.lang.StringgetWordAfterEnumerationOrNull(java.util.List<java.lang.String> words, int idx)private booleanignoreByHangingHyphen(java.util.List<java.lang.String> words, int idx)private booleanignoreCompoundWithIgnoredWord(java.lang.String word)private booleanignoreElative(java.lang.String word)protected booleanignoreWord(java.util.List<java.lang.String> words, int idx)protected voidinit()protected booleanisAcceptedWordFromLanguage(org.languagetool.Language language, java.lang.String word)booleanisMisspelled(java.lang.String word)private booleanisNeedingFugenS(java.lang.String word)private booleanisNoun(java.lang.String word)protected booleanisProhibited(java.lang.String word)protected booleanisQuotedCompound(org.languagetool.AnalyzedSentence analyzedSentence, int idx, java.lang.String token)private static voidput(java.lang.String pattern, java.lang.String replacement)private static voidput(java.lang.String pattern, java.util.function.Function<java.lang.String,java.util.List<java.lang.String>> f)private static voidputRepl(java.lang.String wordPattern, java.lang.String pattern, java.lang.String replacement)protected java.util.List<java.lang.String>sortSuggestionByQuality(java.lang.String misspelling, java.util.List<java.lang.String> suggestions)-
Methods inherited from class org.languagetool.rules.spelling.hunspell.CompoundAwareHunspellRule
getCandidates
-
Methods inherited from class org.languagetool.rules.spelling.hunspell.HunspellRule
getActiveChecks, getDescription, getDictFilenameInResources, getSentenceTextWithoutUrlsAndImmunizedTokens, match, tokenizeText
-
Methods inherited from class org.languagetool.rules.spelling.SpellingCheckRule
acceptedInAlternativeLanguage, acceptPhrases, addIgnoreTokens, addSuggestionsToRuleMatch, createWrongSplitMatch, filterDupes, filterSuggestions, getAdditionalProhibitFileNames, getAdditionalSpellingFileNames, getAdditionalSuggestions, getAlternativeLangSpellingRules, getAntiPatterns, getIgnoreFileName, getLanguageVariantSpellingFileName, getProhibitFileName, getSpellingFileName, ignoreToken, ignoreWord, isDictionaryBasedSpellingRule, isEMail, isUrl, reorderSuggestions, setConsiderIgnoreWords, setConvertsCase, startsWithIgnoredWord
-
Methods inherited from class org.languagetool.rules.Rule
addExamplePair, estimateContextForSureMatch, getCategory, getConfigureText, getCorrectExamples, getDefaultValue, getErrorTriggeringExamples, getIncorrectExamples, getLocQualityIssueType, getMaxConfigurableValue, getMinConfigurableValue, getSentenceWithImmunization, getUrl, hasConfigurableValue, isDefaultOff, isDefaultTempOff, isOfficeDefaultOff, isOfficeDefaultOn, makeAntiPatterns, setCategory, setCorrectExamples, setDefaultOff, setDefaultOn, setDefaultTempOff, setErrorTriggeringExamples, setIncorrectExamples, setLocQualityIssueType, setOfficeDefaultOff, setOfficeDefaultOn, setUrl, supportsLanguage, toRuleMatchArray, useInOffice
-
-
-
-
Field Detail
-
RULE_ID
public static final java.lang.String RULE_ID
- See Also:
- Constant Field Values
-
MAX_EDIT_DISTANCE
private static final int MAX_EDIT_DISTANCE
- See Also:
- Constant Field Values
-
PREVENT_SUGGESTION
private static final java.util.regex.Pattern PREVENT_SUGGESTION
-
wordsToBeIgnoredInCompounds
private final java.util.Set<java.lang.String> wordsToBeIgnoredInCompounds
-
wordStartsToBeProhibited
private final java.util.Set<java.lang.String> wordStartsToBeProhibited
-
wordEndingsToBeProhibited
private final java.util.Set<java.lang.String> wordEndingsToBeProhibited
-
ADDITIONAL_SUGGESTIONS
private static final java.util.Map<java.util.regex.Pattern,java.util.function.Function<java.lang.String,java.util.List<java.lang.String>>> ADDITIONAL_SUGGESTIONS
-
splitter
private static final de.danielnaber.jwordsplitter.GermanWordSplitter splitter
-
lineExpander
private final LineExpander lineExpander
-
compoundTokenizer
private final GermanCompoundTokenizer compoundTokenizer
-
synthesizer
private final org.languagetool.synthesis.Synthesizer synthesizer
-
tagger
private final org.languagetool.tagging.Tagger tagger
-
-
Constructor Detail
-
GermanSpellerRule
public GermanSpellerRule(java.util.ResourceBundle messages, German language)
-
GermanSpellerRule
public GermanSpellerRule(java.util.ResourceBundle messages, German language, org.languagetool.UserConfig userConfig, java.lang.String languageVariantPlainTextDict)- Since:
- 4.2
-
GermanSpellerRule
public GermanSpellerRule(java.util.ResourceBundle messages, German language, org.languagetool.UserConfig userConfig, java.lang.String languageVariantPlainTextDict, java.util.List<org.languagetool.Language> altLanguages, org.languagetool.languagemodel.LanguageModel languageModel)- Since:
- 4.3
-
-
Method Detail
-
putRepl
private static void putRepl(java.lang.String wordPattern, java.lang.String pattern, java.lang.String replacement)
-
put
private static void put(java.lang.String pattern, java.lang.String replacement)
-
put
private static void put(java.lang.String pattern, java.util.function.Function<java.lang.String,java.util.List<java.lang.String>> f)
-
getSplitter
private static de.danielnaber.jwordsplitter.GermanWordSplitter getSplitter()
-
init
protected void init() throws java.io.IOException- Overrides:
initin classorg.languagetool.rules.spelling.hunspell.HunspellRule- Throws:
java.io.IOException
-
getId
public java.lang.String getId()
- Overrides:
getIdin classorg.languagetool.rules.spelling.hunspell.HunspellRule
-
getCandidates
public java.util.List<java.lang.String> getCandidates(java.lang.String word)
- Overrides:
getCandidatesin classorg.languagetool.rules.spelling.hunspell.CompoundAwareHunspellRule
-
isProhibited
protected boolean isProhibited(java.lang.String word)
- Overrides:
isProhibitedin classorg.languagetool.rules.spelling.SpellingCheckRule
-
addIgnoreWords
protected void addIgnoreWords(java.lang.String origLine)
- Overrides:
addIgnoreWordsin classorg.languagetool.rules.spelling.SpellingCheckRule
-
expandLine
protected java.util.List<java.lang.String> expandLine(java.lang.String line)
- Overrides:
expandLinein classorg.languagetool.rules.spelling.SpellingCheckRule
-
getSuggestions
public java.util.List<java.lang.String> getSuggestions(java.lang.String word) throws java.io.IOException- Overrides:
getSuggestionsin classorg.languagetool.rules.spelling.hunspell.CompoundAwareHunspellRule- Throws:
java.io.IOException
-
getSpeller
@Nullable private static @Nullable org.languagetool.rules.spelling.morfologik.MorfologikMultiSpeller getSpeller(org.languagetool.Language language, org.languagetool.UserConfig userConfig, java.lang.String languageVariantPlainTextDict)
-
filterForLanguage
protected void filterForLanguage(java.util.List<java.lang.String> suggestions)
- Specified by:
filterForLanguagein classorg.languagetool.rules.spelling.hunspell.CompoundAwareHunspellRule
-
sortSuggestionByQuality
protected java.util.List<java.lang.String> sortSuggestionByQuality(java.lang.String misspelling, java.util.List<java.lang.String> suggestions)- Overrides:
sortSuggestionByQualityin classorg.languagetool.rules.spelling.hunspell.CompoundAwareHunspellRule
-
getFilteredSuggestions
protected java.util.List<java.lang.String> getFilteredSuggestions(java.util.List<java.lang.String> wordsOrPhrases)
- Overrides:
getFilteredSuggestionsin classorg.languagetool.rules.spelling.hunspell.CompoundAwareHunspellRule
-
isNoun
private boolean isNoun(java.lang.String word)
-
ignoreElative
private boolean ignoreElative(java.lang.String word)
-
isMisspelled
public boolean isMisspelled(java.lang.String word)
- Overrides:
isMisspelledin classorg.languagetool.rules.spelling.hunspell.HunspellRule
-
ignoreWord
protected boolean ignoreWord(java.util.List<java.lang.String> words, int idx) throws java.io.IOException- Overrides:
ignoreWordin classorg.languagetool.rules.spelling.SpellingCheckRule- Throws:
java.io.IOException
-
getAdditionalTopSuggestions
protected java.util.List<java.lang.String> getAdditionalTopSuggestions(java.util.List<java.lang.String> suggestions, java.lang.String word) throws java.io.IOException- Overrides:
getAdditionalTopSuggestionsin classorg.languagetool.rules.spelling.SpellingCheckRule- Throws:
java.io.IOException
-
getPastTenseVerbSuggestion
@Nullable private @Nullable java.lang.String getPastTenseVerbSuggestion(java.lang.String word)
-
baseForThirdPersonSingularVerb
@Nullable private @Nullable java.lang.String baseForThirdPersonSingularVerb(java.lang.String word) throws java.io.IOException- Throws:
java.io.IOException
-
getParticipleSuggestion
@Nullable private @Nullable java.lang.String getParticipleSuggestion(java.lang.String word)
-
getParticipleForBaseform
@Nullable private @Nullable java.lang.String getParticipleForBaseform(java.lang.String baseform) throws java.io.IOException- Throws:
java.io.IOException
-
getAbbreviationSuggestion
private java.lang.String getAbbreviationSuggestion(java.lang.String word) throws java.io.IOException- Throws:
java.io.IOException
-
ignoreByHangingHyphen
private boolean ignoreByHangingHyphen(java.util.List<java.lang.String> words, int idx) throws java.io.IOException- Throws:
java.io.IOException
-
isNeedingFugenS
private boolean isNeedingFugenS(java.lang.String word)
-
getWordAfterEnumerationOrNull
@Nullable private @Nullable java.lang.String getWordAfterEnumerationOrNull(java.util.List<java.lang.String> words, int idx)
-
ignoreCompoundWithIgnoredWord
private boolean ignoreCompoundWithIgnoredWord(java.lang.String word) throws java.io.IOException- Throws:
java.io.IOException
-
isQuotedCompound
protected boolean isQuotedCompound(org.languagetool.AnalyzedSentence analyzedSentence, int idx, java.lang.String token)- Overrides:
isQuotedCompoundin classorg.languagetool.rules.spelling.hunspell.HunspellRule
-
addProhibitedWords
protected void addProhibitedWords(java.util.List<java.lang.String> words)
- Overrides:
addProhibitedWordsin classorg.languagetool.rules.spelling.SpellingCheckRule
-
isAcceptedWordFromLanguage
protected boolean isAcceptedWordFromLanguage(org.languagetool.Language language, java.lang.String word)- Overrides:
isAcceptedWordFromLanguagein classorg.languagetool.rules.spelling.hunspell.HunspellRule
-
-