use of org.languagetool.language.Ukrainian in project languagetool by languagetool-org.
the class MultiWordChunkerTest method testDisambiguateMultiSpace.
@Test
public void testDisambiguateMultiSpace() throws Exception {
Disambiguator chunker = new MultiWordChunker("/uk/multiwords.txt");
JLanguageTool lt = new JLanguageTool(new Ukrainian());
AnalyzedSentence analyzedSentence = lt.getAnalyzedSentence("для годиться.");
AnalyzedSentence disambiguated = chunker.disambiguate(analyzedSentence);
AnalyzedTokenReadings[] tokens = disambiguated.getTokens();
assertTrue(tokens[1].getReadings().toString().contains("<adv>"));
assertTrue(tokens[4].getReadings().toString().contains("</adv>"));
}
use of org.languagetool.language.Ukrainian in project languagetool by languagetool-org.
the class SimpleReplaceRuleTest method testRule.
@Test
public void testRule() throws IOException {
SimpleReplaceRule rule = new SimpleReplaceRule(TestTools.getEnglishMessages());
RuleMatch[] matches;
JLanguageTool langTool = new JLanguageTool(new Ukrainian());
// correct sentences:
matches = rule.match(langTool.getAnalyzedSentence("Ці рядки повинні збігатися."));
assertEquals(0, matches.length);
// incorrect sentences:
matches = rule.match(langTool.getAnalyzedSentence("Ці рядки повинні співпадати."));
assertEquals(1, matches.length);
assertEquals(2, matches[0].getSuggestedReplacements().size());
assertEquals(Arrays.asList("збігатися", "сходитися"), matches[0].getSuggestedReplacements());
matches = rule.match(langTool.getAnalyzedSentence("Нападаючий"));
assertEquals(1, matches.length);
assertEquals(Arrays.asList("Нападник", "Нападальний", "Нападний"), matches[0].getSuggestedReplacements());
matches = rule.match(langTool.getAnalyzedSentence("Нападаючого"));
assertEquals(1, matches.length);
assertEquals(Arrays.asList("Нападник", "Нападальний", "Нападний"), matches[0].getSuggestedReplacements());
// test ignoreTagged
matches = rule.match(langTool.getAnalyzedSentence("щедрота"));
assertEquals(1, matches.length);
assertEquals(Arrays.asList("щедрість", "гойність", "щедриня"), matches[0].getSuggestedReplacements());
matches = rule.match(langTool.getAnalyzedSentence("щедроти"));
assertEquals(0, matches.length);
}
use of org.languagetool.language.Ukrainian in project languagetool by languagetool-org.
the class SimpleReplaceSoftRuleTest method testRule.
@Test
public void testRule() throws IOException {
SimpleReplaceSoftRule rule = new SimpleReplaceSoftRule(TestTools.getEnglishMessages());
RuleMatch[] matches;
JLanguageTool langTool = new JLanguageTool(new Ukrainian());
// correct sentences:
matches = rule.match(langTool.getAnalyzedSentence("Ці рядки повинні збігатися."));
assertEquals(0, matches.length);
matches = rule.match(langTool.getAnalyzedSentence("Цей брелок."));
assertEquals(1, matches.length);
assertEquals(Arrays.asList("дармовис"), matches[0].getSuggestedReplacements());
matches = rule.match(langTool.getAnalyzedSentence("Не знайде спасіння."));
assertEquals(1, matches.length);
assertEquals(Arrays.asList("рятування", "рятунок", "порятунок", "визволення"), matches[0].getSuggestedReplacements());
assertTrue(matches[0].getMessage().contains(": релігія"));
//refl
matches = rule.match(langTool.getAnalyzedSentence("відображаються"));
assertEquals(1, matches.length);
assertEquals(Arrays.asList("показуватися", "зображатися", "відбиватися"), matches[0].getSuggestedReplacements());
assertTrue("No context: " + matches[0].getMessage(), matches[0].getMessage().contains(": математика"));
// test ignoreTagged
// matches = rule.match(langTool.getAnalyzedSentence("щедрота"));
// assertEquals(1, matches.length);
// assertEquals(Arrays.asList("щедрість", "гойність", "щедриня"), matches[0].getSuggestedReplacements());
//
// matches = rule.match(langTool.getAnalyzedSentence("щедроти"));
// assertEquals(0, matches.length);
}
use of org.languagetool.language.Ukrainian in project languagetool by languagetool-org.
the class TokenAgreementRuleTest method setUp.
@Before
public void setUp() throws IOException {
rule = new TokenAgreementRule(TestTools.getMessages("uk"));
langTool = new JLanguageTool(new Ukrainian());
}
use of org.languagetool.language.Ukrainian in project languagetool by languagetool-org.
the class TokenVerbAgreementRuleTest method setUp.
@Before
public void setUp() throws IOException {
rule = new TokenVerbAgreementRule(TestTools.getMessages("uk"));
langTool = new JLanguageTool(new Ukrainian());
}
Aggregations