Search in sources :

Example 1 with ErrorTriggeringExample

use of org.languagetool.rules.ErrorTriggeringExample in project languagetool by languagetool-org.

the class PatternRuleTest method testErrorTriggeringSentences.

private void testErrorTriggeringSentences(JLanguageTool languageTool, Language lang, AbstractPatternRule rule) throws IOException {
    for (ErrorTriggeringExample example : rule.getErrorTriggeringExamples()) {
        String sentence = cleanXML(example.getExample());
        List<RuleMatch> matches = getMatches(rule, sentence, languageTool);
        if (matches.size() == 0) {
            fail(lang + ": " + rule.getFullId() + ": Example sentence marked with 'triggers_error' didn't actually trigger an error: '" + sentence + "'");
        }
    }
}
Also used : RuleMatch(org.languagetool.rules.RuleMatch) ErrorTriggeringExample(org.languagetool.rules.ErrorTriggeringExample)

Aggregations

ErrorTriggeringExample (org.languagetool.rules.ErrorTriggeringExample)1 RuleMatch (org.languagetool.rules.RuleMatch)1