use of org.languagetool.language.CanadianEnglish in project languagetool by languagetool-org.
the class MorfologikCanadianSpellerRuleTest method testMorfologikSpeller.
@Test
public void testMorfologikSpeller() throws IOException {
CanadianEnglish language = new CanadianEnglish();
MorfologikBritishSpellerRule rule = new MorfologikBritishSpellerRule(TestTools.getMessages("en"), language);
JLanguageTool langTool = new JLanguageTool(language);
// correct sentences:
assertEquals(0, rule.match(langTool.getAnalyzedSentence("This is an example: we get behaviour as a dictionary word.")).length);
assertEquals(0, rule.match(langTool.getAnalyzedSentence("Why don't we speak today.")).length);
//with doesn't
assertEquals(0, rule.match(langTool.getAnalyzedSentence("He doesn't know what to do.")).length);
assertEquals(0, rule.match(langTool.getAnalyzedSentence(",")).length);
assertEquals(0, rule.match(langTool.getAnalyzedSentence("123454")).length);
//incorrect sentences:
RuleMatch[] matches = rule.match(langTool.getAnalyzedSentence("arbor"));
// check match positions:
assertEquals(1, matches.length);
assertEquals(0, matches[0].getFromPos());
assertEquals(5, matches[0].getToPos());
assertEquals("arbour", matches[0].getSuggestedReplacements().get(0));
assertEquals(1, rule.match(langTool.getAnalyzedSentence("aõh")).length);
assertEquals(0, rule.match(langTool.getAnalyzedSentence("a")).length);
}
use of org.languagetool.language.CanadianEnglish in project languagetool by languagetool-org.
the class MorfologikCanadianSpellerRuleTest method testSuggestions.
@Test
public void testSuggestions() throws IOException {
Language language = new CanadianEnglish();
Rule rule = new MorfologikCanadianSpellerRule(TestTools.getMessages("en"), language);
super.testNonVariantSpecificSuggestions(rule, language);
}
Aggregations