class CompoundFilter extends RuleFilter {

  private static final Pattern SUGGESTION_ELEM = Pattern.compile("<suggestion>.*?</suggestion>");

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

}

    List<String> words = new ArrayList<>();
    for (int i = 1; i < 6; i++) {
      String arg = arguments.get("word" + i);
      if (arg == null) {
        break;
      }
      words.add(arguments.get("word" + i));
    }
    String repl = glueParts(words);
    String message = SUGGESTION_ELEM.matcher(match.getMessage()).replaceAll("<suggestion>" + repl + "</suggestion>");
    String shortMessage = SUGGESTION_ELEM.matcher(match.getShortMessage()).replaceAll("<suggestion>" + repl + "</suggestion>");
    RuleMatch newMatch = new RuleMatch(match.getRule(), match.getSentence(), match.getFromPos(), match.getToPos(), message, shortMessage);
    newMatch.setSuggestedReplacement(repl);
    return newMatch;
  
<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>