use of org.languagetool.language.Russian in project languagetool by languagetool-org.
the class RussianSimpleReplaceRuleTest method testRule.
@Test
public void testRule() throws IOException {
RussianSimpleReplaceRule rule = new RussianSimpleReplaceRule(TestTools.getMessages("ru"));
RuleMatch[] matches;
JLanguageTool langTool = new JLanguageTool(new Russian());
// correct sentences:
matches = rule.match(langTool.getAnalyzedSentence("Рост кораллов тут самый быстрый,"));
assertEquals(0, matches.length);
matches = rule.match(langTool.getAnalyzedSentence("Книга была порвана."));
assertEquals(0, matches.length);
// incorrect sentences:
matches = rule.match(langTool.getAnalyzedSentence("Книга была порвата."));
assertEquals(1, matches.length);
assertEquals(1, matches[0].getSuggestedReplacements().size());
assertEquals("порвана", matches[0].getSuggestedReplacements().get(0));
}
use of org.languagetool.language.Russian in project languagetool by languagetool-org.
the class RussianUnpairedBracketsRuleTest method testRuleRussian.
@Test
public void testRuleRussian() throws IOException {
RussianUnpairedBracketsRule rule = new RussianUnpairedBracketsRule(TestTools.getEnglishMessages(), new Russian());
RuleMatch[] matches;
JLanguageTool langTool = new JLanguageTool(new Russian());
// correct sentences:
matches = rule.match(Collections.singletonList(langTool.getAnalyzedSentence("(О жене и детях не беспокойся, я беру их на свои руки).")));
assertEquals(0, matches.length);
// correct sentences:
matches = rule.match(Collections.singletonList(langTool.getAnalyzedSentence("Позже выходит другая «южная поэма» «Бахчисарайский фонтан» (1824).")));
assertEquals(0, matches.length);
matches = rule.match(Collections.singletonList(langTool.getAnalyzedSentence("А \"б\" Д.")));
assertEquals(0, matches.length);
matches = rule.match(Collections.singletonList(langTool.getAnalyzedSentence("а), б), Д)..., ДД), аа) и 1а)")));
assertEquals(0, matches.length);
// incorrect sentences:
matches = rule.match(Collections.singletonList(langTool.getAnalyzedSentence("В таком ключе был начат в мае 1823 в Кишинёве роман в стихах 'Евгений Онегин.")));
assertEquals(1, matches.length);
}
use of org.languagetool.language.Russian in project languagetool by languagetool-org.
the class RussianCompoundRuleTest method setUp.
@Before
public void setUp() throws Exception {
lt = new JLanguageTool(new Russian());
rule = new RussianCompoundRule(TestTools.getEnglishMessages());
}
Aggregations