use of org.languagetool.language.NewZealandEnglish in project languagetool by languagetool-org.
the class MorfologikNewZealandSpellerRuleTest method testMorfologikSpeller.
@Test
public void testMorfologikSpeller() throws IOException {
NewZealandEnglish language = new NewZealandEnglish();
MorfologikNewZealandSpellerRule rule = new MorfologikNewZealandSpellerRule(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);
//special New Zealand content:
assertEquals(0, rule.match(langTool.getAnalyzedSentence("Abercrombie")).length);
//incorrect sentences:
RuleMatch[] matches1 = rule.match(langTool.getAnalyzedSentence("behavior"));
// check match positions:
assertEquals(1, matches1.length);
assertEquals(0, matches1[0].getFromPos());
assertEquals(8, matches1[0].getToPos());
assertEquals("behaviour", matches1[0].getSuggestedReplacements().get(0));
assertEquals(1, rule.match(langTool.getAnalyzedSentence("aõh")).length);
assertEquals(0, rule.match(langTool.getAnalyzedSentence("a")).length);
//based on replacement pairs:
RuleMatch[] matches2 = rule.match(langTool.getAnalyzedSentence("He teached us."));
// check match positions:
assertEquals(1, matches2.length);
assertEquals(3, matches2[0].getFromPos());
assertEquals(10, matches2[0].getToPos());
assertEquals("taught", matches2[0].getSuggestedReplacements().get(0));
}
use of org.languagetool.language.NewZealandEnglish in project languagetool by languagetool-org.
the class NewZealandReplaceRuleTest method setUp.
@Before
public void setUp() throws Exception {
rule = new NewZealandReplaceRule(TestTools.getMessages("en"));
langTool = new JLanguageTool(new NewZealandEnglish());
}
use of org.languagetool.language.NewZealandEnglish in project languagetool by languagetool-org.
the class MorfologikNewZealandSpellerRuleTest method testSuggestions.
@Test
public void testSuggestions() throws IOException {
Language language = new NewZealandEnglish();
Rule rule = new MorfologikNewZealandSpellerRule(TestTools.getMessages("en"), language);
super.testNonVariantSpecificSuggestions(rule, language);
}
Aggregations