class PotentialCompoundFilter extends RuleFilter {

  @Override
  public RuleMatch acceptRuleMatch(RuleMatch match, Map<String, String> arguments, int patternTokenPos,
                                   AnalyzedTokenReadings[] patternTokens, List<Integer> tokenPositions) throws IOException {<FILL_FUNCTION_BODY>}
}

    String part1 = arguments.get("part1");
    String part2 = arguments.get("part2");
    String part1capitalized = part1;
    String part2capitalized = part2;
    String part2lowercase = part2;
    if (!StringTools.isMixedCase(part2) && !StringTools.isAllUppercase(part2)) {
      part2lowercase = part2.toLowerCase();
      part2capitalized = StringTools.uppercaseFirstChar(part2.toLowerCase());
    }
    if (!StringTools.isMixedCase(part1) && !StringTools.isAllUppercase(part1)) {
      part1capitalized = StringTools.uppercaseFirstChar(part1.toLowerCase());
    }
    String joinedWord = part1capitalized + part2lowercase;
    String hyphenatedWord = part1capitalized + "-" + part2capitalized;
    List<String> replacements = new ArrayList<>();
    // create an AnalyzedSentence without instantiating a new JLanguageTool
    List<String> tokens =  Collections.singletonList(joinedWord);
    List<AnalyzedTokenReadings> tokensList = GermanyGerman.INSTANCE.getTagger().tag(tokens);
    AnalyzedTokenReadings[] tokensArray = new AnalyzedTokenReadings[2];
    AnalyzedToken sentenceStartToken = new AnalyzedToken("", "SENT_START", null);
    AnalyzedToken[] startTokenArray = new AnalyzedToken[1];
    startTokenArray[0] = sentenceStartToken;
    tokensArray[0] = new AnalyzedTokenReadings(startTokenArray, 0);
    tokensArray[1] = tokensList.get(0);
    AnalyzedSentence analyzedSentence = new AnalyzedSentence(tokensArray);
    // check with the spelling rule
    RuleMatch[] matches = GermanyGerman.INSTANCE.getDefaultSpellingRule().match(analyzedSentence);
    if (matches.length == 0) {
      if (joinedWord.length() > 20) {
        replacements.add(hyphenatedWord);
      }
      replacements.add(joinedWord);
    } else {
      replacements.add(hyphenatedWord);
    }
    if (!replacements.isEmpty()) {
      String message = match.getMessage();
      RuleMatch ruleMatch = new RuleMatch(match.getRule(), match.getSentence(), match.getFromPos(), match.getToPos(),
          message, match.getShortMessage());
      ruleMatch.setType(match.getType());
      ruleMatch.setSuggestedReplacements(replacements);
      return ruleMatch;
    }
    return null;
  
<methods>public non-sealed void <init>() ,public abstract org.languagetool.rules.RuleMatch acceptRuleMatch(org.languagetool.rules.RuleMatch, Map<java.lang.String,java.lang.String>, int, org.languagetool.AnalyzedTokenReadings[], List<java.lang.Integer>) throws java.io.IOException,public boolean matches(Map<java.lang.String,java.lang.String>, org.languagetool.AnalyzedTokenReadings[], int, List<java.lang.Integer>) throws java.io.IOException<variables>