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 class
GermanSpellerRule.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_SUGGESTIONS
private GermanCompoundTokenizer
compoundTokenizer
private LineExpander
lineExpander
private static int
MAX_EDIT_DISTANCE
private static java.util.regex.Pattern
PREVENT_SUGGESTION
static java.lang.String
RULE_ID
private static de.danielnaber.jwordsplitter.GermanWordSplitter
splitter
private org.languagetool.synthesis.Synthesizer
synthesizer
private org.languagetool.tagging.Tagger
tagger
private java.util.Set<java.lang.String>
wordEndingsToBeProhibited
private java.util.Set<java.lang.String>
wordStartsToBeProhibited
private 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 void
addIgnoreWords(java.lang.String origLine)
protected void
addProhibitedWords(java.util.List<java.lang.String> words)
private @Nullable java.lang.String
baseForThirdPersonSingularVerb(java.lang.String word)
protected java.util.List<java.lang.String>
expandLine(java.lang.String line)
protected void
filterForLanguage(java.util.List<java.lang.String> suggestions)
private java.lang.String
getAbbreviationSuggestion(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.String
getId()
private @Nullable java.lang.String
getParticipleForBaseform(java.lang.String baseform)
private @Nullable java.lang.String
getParticipleSuggestion(java.lang.String word)
private @Nullable java.lang.String
getPastTenseVerbSuggestion(java.lang.String word)
private static @Nullable org.languagetool.rules.spelling.morfologik.MorfologikMultiSpeller
getSpeller(org.languagetool.Language language, org.languagetool.UserConfig userConfig, java.lang.String languageVariantPlainTextDict)
private static de.danielnaber.jwordsplitter.GermanWordSplitter
getSplitter()
java.util.List<java.lang.String>
getSuggestions(java.lang.String word)
private @Nullable java.lang.String
getWordAfterEnumerationOrNull(java.util.List<java.lang.String> words, int idx)
private boolean
ignoreByHangingHyphen(java.util.List<java.lang.String> words, int idx)
private boolean
ignoreCompoundWithIgnoredWord(java.lang.String word)
private boolean
ignoreElative(java.lang.String word)
protected boolean
ignoreWord(java.util.List<java.lang.String> words, int idx)
protected void
init()
protected boolean
isAcceptedWordFromLanguage(org.languagetool.Language language, java.lang.String word)
boolean
isMisspelled(java.lang.String word)
private boolean
isNeedingFugenS(java.lang.String word)
private boolean
isNoun(java.lang.String word)
protected boolean
isProhibited(java.lang.String word)
protected boolean
isQuotedCompound(org.languagetool.AnalyzedSentence analyzedSentence, int idx, java.lang.String token)
private static void
put(java.lang.String pattern, java.lang.String replacement)
private static void
put(java.lang.String pattern, java.util.function.Function<java.lang.String,java.util.List<java.lang.String>> f)
private static void
putRepl(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:
init
in classorg.languagetool.rules.spelling.hunspell.HunspellRule
- Throws:
java.io.IOException
-
getId
public java.lang.String getId()
- Overrides:
getId
in classorg.languagetool.rules.spelling.hunspell.HunspellRule
-
getCandidates
public java.util.List<java.lang.String> getCandidates(java.lang.String word)
- Overrides:
getCandidates
in classorg.languagetool.rules.spelling.hunspell.CompoundAwareHunspellRule
-
isProhibited
protected boolean isProhibited(java.lang.String word)
- Overrides:
isProhibited
in classorg.languagetool.rules.spelling.SpellingCheckRule
-
addIgnoreWords
protected void addIgnoreWords(java.lang.String origLine)
- Overrides:
addIgnoreWords
in classorg.languagetool.rules.spelling.SpellingCheckRule
-
expandLine
protected java.util.List<java.lang.String> expandLine(java.lang.String line)
- Overrides:
expandLine
in classorg.languagetool.rules.spelling.SpellingCheckRule
-
getSuggestions
public java.util.List<java.lang.String> getSuggestions(java.lang.String word) throws java.io.IOException
- Overrides:
getSuggestions
in 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:
filterForLanguage
in 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:
sortSuggestionByQuality
in classorg.languagetool.rules.spelling.hunspell.CompoundAwareHunspellRule
-
getFilteredSuggestions
protected java.util.List<java.lang.String> getFilteredSuggestions(java.util.List<java.lang.String> wordsOrPhrases)
- Overrides:
getFilteredSuggestions
in 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:
isMisspelled
in classorg.languagetool.rules.spelling.hunspell.HunspellRule
-
ignoreWord
protected boolean ignoreWord(java.util.List<java.lang.String> words, int idx) throws java.io.IOException
- Overrides:
ignoreWord
in 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:
getAdditionalTopSuggestions
in 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:
isQuotedCompound
in classorg.languagetool.rules.spelling.hunspell.HunspellRule
-
addProhibitedWords
protected void addProhibitedWords(java.util.List<java.lang.String> words)
- Overrides:
addProhibitedWords
in classorg.languagetool.rules.spelling.SpellingCheckRule
-
isAcceptedWordFromLanguage
protected boolean isAcceptedWordFromLanguage(org.languagetool.Language language, java.lang.String word)
- Overrides:
isAcceptedWordFromLanguage
in classorg.languagetool.rules.spelling.hunspell.HunspellRule
-
-