Class ProhibitedCompoundRule

java.lang.Object
org.languagetool.rules.Rule
org.languagetool.rules.de.ProhibitedCompoundRule

public class ProhibitedCompoundRule extends org.languagetool.rules.Rule
Find compounds that might be morphologically correct but are still probably wrong, like 'Lehrzeile'.
Since:
4.1
  • Field Details

  • Constructor Details

    • ProhibitedCompoundRule

      public ProhibitedCompoundRule(ResourceBundle messages, org.languagetool.languagemodel.LanguageModel lm)
  • Method Details

    • addAllCaseVariants

      private static void addAllCaseVariants(List<ProhibitedCompoundRule.Pair> candidatePairs, ProhibitedCompoundRule.Pair lcPair)
    • addUpperCaseVariants

      private static void addUpperCaseVariants(List<ProhibitedCompoundRule.Pair> pairs)
    • addItemsFromConfusionSets

      protected static void addItemsFromConfusionSets(List<ProhibitedCompoundRule.Pair> pairs, String confusionSetsFile, boolean isUpperCase)
    • setupAhoCorasickSearch

      protected static com.hankcs.algorithm.AhoCorasickDoubleArrayTrie<String> setupAhoCorasickSearch(List<ProhibitedCompoundRule.Pair> pairs, Map<String,List<ProhibitedCompoundRule.Pair>> pairMap)
    • getId

      public String getId()
      Specified by:
      getId in class org.languagetool.rules.Rule
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in class org.languagetool.rules.Rule
    • match

      public org.languagetool.rules.RuleMatch[] match(org.languagetool.AnalyzedSentence sentence) throws IOException
      Specified by:
      match in class org.languagetool.rules.Rule
      Throws:
      IOException
    • setConfusionPair

      public void setConfusionPair(ProhibitedCompoundRule.Pair confusionPair)
      ignore automatically loaded pairs and only match using given confusionPair used for evaluation by ProhibitedCompoundRuleEvaluator
      Parameters:
      confusionPair - pair to evaluate, parts are assumed to be lowercase / null to reset