Search in sources :

Example 21 with PatternToken

use of org.languagetool.rules.patterns.PatternToken in project languagetool by languagetool-org.

the class RuleWithMaxFilterTest method testNoFilteringIfNotOverlapping.

@Test
public void testNoFilteringIfNotOverlapping() {
    List<PatternToken> fakePatternTokens = new ArrayList<>();
    PatternRule rule1 = new PatternRule("id1", language, fakePatternTokens, "desc1", "msg1", "shortMsg1");
    PatternRule rule2 = new PatternRule("id1", language, fakePatternTokens, "desc2", "msg2", "shortMsg2");
    RuleMatch match1 = new RuleMatch(rule1, 10, 20, "Match1");
    RuleMatch match2 = new RuleMatch(rule2, 21, 25, "Match2");
    RuleWithMaxFilter filter = new RuleWithMaxFilter();
    List<RuleMatch> filteredMatches = filter.filter(Arrays.asList(match1, match2));
    assertEquals(2, filteredMatches.size());
}
Also used : PatternToken(org.languagetool.rules.patterns.PatternToken) PatternRule(org.languagetool.rules.patterns.PatternRule) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

PatternToken (org.languagetool.rules.patterns.PatternToken)21 PatternRule (org.languagetool.rules.patterns.PatternRule)17 ArrayList (java.util.ArrayList)9 Test (org.junit.Test)8 English (org.languagetool.language.English)7 Rule (org.languagetool.rules.Rule)6 RuleMatch (org.languagetool.rules.RuleMatch)5 PatternTokenBuilder (org.languagetool.rules.patterns.PatternTokenBuilder)2 BufferedReader (java.io.BufferedReader)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 AmericanEnglish (org.languagetool.language.AmericanEnglish)1 BritishEnglish (org.languagetool.language.BritishEnglish)1 SpellingCheckRule (org.languagetool.rules.spelling.SpellingCheckRule)1