Search in sources :

Example 1 with Persian

use of org.languagetool.language.Persian in project languagetool by languagetool-org.

the class WordCoherencyRuleTest method testRules.

@Test
public void testRules() throws IOException {
    JLanguageTool langTool = new JLanguageTool(new Persian());
    TextLevelRule rule = new WordCoherencyRule(TestTools.getMessages("fa"));
    assertThat(rule.match(Collections.singletonList(langTool.getAnalyzedSentence("این یک اتاق است."))).length, is(0));
    assertThat(rule.match(Collections.singletonList(langTool.getAnalyzedSentence("این یک اتاق است. این یک اطاق است."))).length, is(1));
}
Also used : JLanguageTool(org.languagetool.JLanguageTool) Persian(org.languagetool.language.Persian) TextLevelRule(org.languagetool.rules.TextLevelRule) Test(org.junit.Test) PatternRuleTest(org.languagetool.rules.patterns.PatternRuleTest)

Aggregations

Test (org.junit.Test)1 JLanguageTool (org.languagetool.JLanguageTool)1 Persian (org.languagetool.language.Persian)1 TextLevelRule (org.languagetool.rules.TextLevelRule)1 PatternRuleTest (org.languagetool.rules.patterns.PatternRuleTest)1