Search in sources :

Example 1 with Tagalog

use of org.languagetool.language.Tagalog in project languagetool by languagetool-org.

the class MorfologikTagalogSpellerRuleTest method testMorfologikSpeller.

@Test
public void testMorfologikSpeller() throws IOException {
    Tagalog language = new Tagalog();
    MorfologikTagalogSpellerRule rule = new MorfologikTagalogSpellerRule(TestTools.getMessages("en"), language);
    JLanguageTool langTool = new JLanguageTool(language);
    assertEquals(0, rule.match(langTool.getAnalyzedSentence("Ang talatang ito ay nagpapakita ng ng kakayahan ng LanguageTool at halimbawa kung paano ito gamitin.")).length);
    RuleMatch[] matches = rule.match(langTool.getAnalyzedSentence("Ang talatang ito ay nagpapakita ng ng kakayahan ng LanguageTool at hinahalimbawa kung paano ito gamitin."));
    assertEquals(1, matches.length);
    assertEquals(67, matches[0].getFromPos());
    assertEquals(80, matches[0].getToPos());
    assertEquals("hina halimbawa", matches[0].getSuggestedReplacements().get(0));
}
Also used : RuleMatch(org.languagetool.rules.RuleMatch) JLanguageTool(org.languagetool.JLanguageTool) Tagalog(org.languagetool.language.Tagalog) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 JLanguageTool (org.languagetool.JLanguageTool)1 Tagalog (org.languagetool.language.Tagalog)1 RuleMatch (org.languagetool.rules.RuleMatch)1