use of org.languagetool.JLanguageTool 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.JLanguageTool in project languagetool by languagetool-org.
the class CompoundRuleTest method setUp.
@Before
public void setUp() throws Exception {
lt = new JLanguageTool(new Slovak());
rule = new CompoundRule(TestTools.getEnglishMessages());
}
use of org.languagetool.JLanguageTool in project languagetool by languagetool-org.
the class CompoundRuleTest method setUp.
@Before
public void setUp() throws Exception {
lt = new JLanguageTool(new Polish());
rule = new CompoundRule(TestTools.getEnglishMessages());
}
use of org.languagetool.JLanguageTool in project languagetool by languagetool-org.
the class ToolsTest method testCheck.
@Test
public void testCheck() throws IOException, ParserConfigurationException, SAXException {
final JLanguageTool tool = new JLanguageTool(new Polish());
List<RuleMatch> matches = tool.check("To jest całkowicie prawidłowe zdanie.");
assertEquals(0, matches.size());
List<RuleMatch> matches2 = tool.check("To jest problem problem.");
assertEquals(1, matches2.size());
assertEquals("WORD_REPEAT_RULE", matches2.get(0).getRule().getId());
}
use of org.languagetool.JLanguageTool in project languagetool by languagetool-org.
the class PortugueseWikipediaRuleTest method setUp.
@Before
public void setUp() throws Exception {
rule = new PortugueseWikipediaRule(TestTools.getMessages("pt"));
langTool = new JLanguageTool(new Portuguese());
}
Aggregations