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
  • Field Details

    • RULE_ID

      public static final String RULE_ID
      See Also:
    • MAX_EDIT_DISTANCE

      private static final int MAX_EDIT_DISTANCE
      See Also:
    • PREVENT_SUGGESTION

      private static final Pattern PREVENT_SUGGESTION
    • wordsToBeIgnoredInCompounds

      private final Set<String> wordsToBeIgnoredInCompounds
    • wordStartsToBeProhibited

      private final Set<String> wordStartsToBeProhibited
    • wordEndingsToBeProhibited

      private final Set<String> wordEndingsToBeProhibited
    • ADDITIONAL_SUGGESTIONS

      private static final Map<Pattern,Function<String,List<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 Details

    • GermanSpellerRule

      public GermanSpellerRule(ResourceBundle messages, German language)
    • GermanSpellerRule

      public GermanSpellerRule(ResourceBundle messages, German language, org.languagetool.UserConfig userConfig, String languageVariantPlainTextDict)
      Since:
      4.2
    • GermanSpellerRule

      public GermanSpellerRule(ResourceBundle messages, German language, org.languagetool.UserConfig userConfig, String languageVariantPlainTextDict, List<org.languagetool.Language> altLanguages, org.languagetool.languagemodel.LanguageModel languageModel)
      Since:
      4.3
  • Method Details

    • putRepl

      private static void putRepl(String wordPattern, String pattern, String replacement)
    • put

      private static void put(String pattern, String replacement)
    • put

      private static void put(String pattern, Function<String,List<String>> f)
    • getSplitter

      private static de.danielnaber.jwordsplitter.GermanWordSplitter getSplitter()
    • init

      protected void init() throws IOException
      Overrides:
      init in class org.languagetool.rules.spelling.hunspell.HunspellRule
      Throws:
      IOException
    • getId

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

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

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

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

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

      public List<String> getSuggestions(String word) throws IOException
      Overrides:
      getSuggestions in class org.languagetool.rules.spelling.hunspell.CompoundAwareHunspellRule
      Throws:
      IOException
    • getSpeller

      @Nullable private static @Nullable org.languagetool.rules.spelling.morfologik.MorfologikMultiSpeller getSpeller(org.languagetool.Language language, org.languagetool.UserConfig userConfig, String languageVariantPlainTextDict)
    • filterForLanguage

      protected void filterForLanguage(List<String> suggestions)
      Specified by:
      filterForLanguage in class org.languagetool.rules.spelling.hunspell.CompoundAwareHunspellRule
    • sortSuggestionByQuality

      protected List<String> sortSuggestionByQuality(String misspelling, List<String> suggestions)
      Overrides:
      sortSuggestionByQuality in class org.languagetool.rules.spelling.hunspell.CompoundAwareHunspellRule
    • getFilteredSuggestions

      protected List<String> getFilteredSuggestions(List<String> wordsOrPhrases)
      Overrides:
      getFilteredSuggestions in class org.languagetool.rules.spelling.hunspell.CompoundAwareHunspellRule
    • isNoun

      private boolean isNoun(String word)
    • ignoreElative

      private boolean ignoreElative(String word)
    • isMisspelled

      public boolean isMisspelled(String word)
      Overrides:
      isMisspelled in class org.languagetool.rules.spelling.hunspell.HunspellRule
    • ignoreWord

      protected boolean ignoreWord(List<String> words, int idx) throws IOException
      Overrides:
      ignoreWord in class org.languagetool.rules.spelling.SpellingCheckRule
      Throws:
      IOException
    • getAdditionalTopSuggestions

      protected List<String> getAdditionalTopSuggestions(List<String> suggestions, String word) throws IOException
      Overrides:
      getAdditionalTopSuggestions in class org.languagetool.rules.spelling.SpellingCheckRule
      Throws:
      IOException
    • getPastTenseVerbSuggestion

      @Nullable private @Nullable String getPastTenseVerbSuggestion(String word)
    • baseForThirdPersonSingularVerb

      @Nullable private @Nullable String baseForThirdPersonSingularVerb(String word) throws IOException
      Throws:
      IOException
    • getParticipleSuggestion

      @Nullable private @Nullable String getParticipleSuggestion(String word)
    • getParticipleForBaseform

      @Nullable private @Nullable String getParticipleForBaseform(String baseform) throws IOException
      Throws:
      IOException
    • getAbbreviationSuggestion

      private String getAbbreviationSuggestion(String word) throws IOException
      Throws:
      IOException
    • ignoreByHangingHyphen

      private boolean ignoreByHangingHyphen(List<String> words, int idx) throws IOException
      Throws:
      IOException
    • isNeedingFugenS

      private boolean isNeedingFugenS(String word)
    • getWordAfterEnumerationOrNull

      @Nullable private @Nullable String getWordAfterEnumerationOrNull(List<String> words, int idx)
    • ignoreCompoundWithIgnoredWord

      private boolean ignoreCompoundWithIgnoredWord(String word) throws IOException
      Throws:
      IOException
    • isQuotedCompound

      protected boolean isQuotedCompound(org.languagetool.AnalyzedSentence analyzedSentence, int idx, String token)
      Overrides:
      isQuotedCompound in class org.languagetool.rules.spelling.hunspell.HunspellRule
    • addProhibitedWords

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

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