use of org.languagetool.rules.WordRepeatRule in project languagetool by languagetool-org.
the class RuleLinkTest method testBuildReactivationLink.
@Test
public void testBuildReactivationLink() {
Language language = new English();
RuleLink ruleLink = RuleLink.buildReactivationLink(new WordRepeatRule(TestTools.getMessages(language.getShortCode()), language));
assertEquals("WORD_REPEAT_RULE", ruleLink.getId());
assertEquals("http://languagetool.org/reactivate/WORD_REPEAT_RULE", ruleLink.toString());
}
use of org.languagetool.rules.WordRepeatRule in project languagetool by languagetool-org.
the class RuleLinkTest method testBuildDeactivationLink.
@Test
public void testBuildDeactivationLink() {
Language language = new English();
RuleLink ruleLink = RuleLink.buildDeactivationLink(new WordRepeatRule(TestTools.getMessages(language.getShortCode()), language));
assertEquals("WORD_REPEAT_RULE", ruleLink.getId());
assertEquals("http://languagetool.org/deactivate/WORD_REPEAT_RULE", ruleLink.toString());
}
use of org.languagetool.rules.WordRepeatRule in project languagetool by languagetool-org.
the class CommandLineToolsTest method testCheck.
@Test
public void testCheck() throws IOException, ParserConfigurationException, SAXException {
JLanguageTool tool = new JLanguageTool(TestTools.getDemoLanguage());
int matches = CommandLineTools.checkText("Foo.", tool);
String output = new String(this.out.toByteArray());
assertEquals(0, output.indexOf("Time:"));
assertEquals(0, matches);
tool.disableRule("test_unification_with_negation");
tool.addRule(new WordRepeatRule(TestTools.getEnglishMessages(), TestTools.getDemoLanguage()));
matches = CommandLineTools.checkText("To jest problem problem.", tool);
output = new String(this.out.toByteArray());
assertTrue(output.contains("Rule ID: WORD_REPEAT_RULE"));
assertEquals(1, matches);
}
use of org.languagetool.rules.WordRepeatRule in project languagetool by languagetool-org.
the class WordRepeatRuleTest method testRulePolish.
@Test
public void testRulePolish() throws IOException {
final Polish polish = new Polish();
final WordRepeatRule rule = new WordRepeatRule(TestTools.getEnglishMessages(), polish);
RuleMatch[] matches;
final JLanguageTool langTool = new JLanguageTool(polish);
// correct sentences:
matches = rule.match(langTool.getAnalyzedSentence("To jest zdanie."));
assertEquals(0, matches.length);
// with immunized words:
assertEquals(0, rule.match(langTool.getAnalyzedSentence("W w. XVI język jest jak kipiący kocioł.")).length);
assertEquals(0, rule.match(langTool.getAnalyzedSentence("Co jeszcze było smutniejsze, to to, że im się jeść chciało potężnie.")).length);
assertEquals(0, rule.match(langTool.getAnalyzedSentence("Tra ta ta!")).length);
// incorrect sentences:
matches = rule.match(langTool.getAnalyzedSentence("To jest jest zdanie."));
assertEquals(1, matches.length);
}
Aggregations