Class GermanSpellerRule

    • 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
      • Fields inherited from class org.languagetool.rules.spelling.SpellingCheckRule

        ignoreWordsWithLength, language, languageModel, LANGUAGETOOL, LANGUAGETOOLER, wordListLoader
      • Fields inherited from class org.languagetool.rules.Rule

        messages
    • 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • 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
      • 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 class org.languagetool.rules.spelling.hunspell.HunspellRule
        Throws:
        java.io.IOException
      • getId

        public java.lang.String getId()
        Overrides:
        getId in class org.languagetool.rules.spelling.hunspell.HunspellRule
      • getCandidates

        public java.util.List<java.lang.String> getCandidates​(java.lang.String word)
        Overrides:
        getCandidates in class org.languagetool.rules.spelling.hunspell.CompoundAwareHunspellRule
      • isProhibited

        protected boolean isProhibited​(java.lang.String word)
        Overrides:
        isProhibited in class org.languagetool.rules.spelling.SpellingCheckRule
      • addIgnoreWords

        protected void addIgnoreWords​(java.lang.String origLine)
        Overrides:
        addIgnoreWords in class org.languagetool.rules.spelling.SpellingCheckRule
      • expandLine

        protected java.util.List<java.lang.String> expandLine​(java.lang.String line)
        Overrides:
        expandLine in class org.languagetool.rules.spelling.SpellingCheckRule
      • getSuggestions

        public java.util.List<java.lang.String> getSuggestions​(java.lang.String word)
                                                        throws java.io.IOException
        Overrides:
        getSuggestions in class org.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 class org.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 class org.languagetool.rules.spelling.hunspell.CompoundAwareHunspellRule
      • getFilteredSuggestions

        protected java.util.List<java.lang.String> getFilteredSuggestions​(java.util.List<java.lang.String> wordsOrPhrases)
        Overrides:
        getFilteredSuggestions in class org.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 class org.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 class org.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 class org.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 class org.languagetool.rules.spelling.hunspell.HunspellRule
      • addProhibitedWords

        protected void addProhibitedWords​(java.util.List<java.lang.String> words)
        Overrides:
        addProhibitedWords in class org.languagetool.rules.spelling.SpellingCheckRule
      • isAcceptedWordFromLanguage

        protected boolean isAcceptedWordFromLanguage​(org.languagetool.Language language,
                                                     java.lang.String word)
        Overrides:
        isAcceptedWordFromLanguage in class org.languagetool.rules.spelling.hunspell.HunspellRule