class OrdinalSuffixFilter extends RuleFilter {

  private static final Pattern PATTERN = Pattern.compile(".*(11|12|13)");
  private static final Pattern NON_DIGITS = Pattern.compile("[^0-9]");

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

    String ordinal = NON_DIGITS.matcher(match.getSuggestedReplacements().get(0)).replaceAll("");
    if (PATTERN.matcher(ordinal).matches()) {
      match.setSuggestedReplacement(ordinal + "th");
    } else if (ordinal.endsWith("1")) {
      match.setSuggestedReplacement(ordinal + "st");
    } else if (ordinal.endsWith("2")) {
      match.setSuggestedReplacement(ordinal + "nd");
    } else if (ordinal.endsWith("3")) {
      match.setSuggestedReplacement(ordinal + "rd");
    } else {
      match.setSuggestedReplacement(ordinal + "th");
    }
    return match;
  
<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>