Search in sources :

Example 1 with RuleBasedAnalyzer

use of zemberek.morphology.analysis.RuleBasedAnalyzer in project zemberek-nlp by ahmetaa.

the class TurkishMorphologyFunctionalTests method testAsciiTolerantMorphology.

@Test
public void testAsciiTolerantMorphology() {
    // Instance with no dictionary item.
    TurkishMorphology morphology = getAsciiTolerantMorphology("sıra", "şıra", "armut", "kazan", "ekonomik [P:Adj]", "insan");
    RuleBasedAnalyzer analyzer = morphology.getAnalyzer();
    List<SingleAnalysis> result;
    result = analyzer.analyze("ekonomık");
    Assert.assertTrue(containsAllDictionaryLemma(result, "ekonomik"));
    result = analyzer.analyze("sira");
    Assert.assertEquals(2, result.size());
    Assert.assertTrue(containsAllDictionaryLemma(result, "sıra", "şıra"));
    result = analyzer.analyze("siraci");
    Assert.assertTrue(containsAllDictionaryLemma(result, "sıra", "şıra"));
    result = analyzer.analyze("armutcuga");
    Assert.assertTrue(containsAllDictionaryLemma(result, "armut"));
    result = analyzer.analyze("kazancıga");
    Assert.assertTrue(containsAllDictionaryLemma(result, "kazan"));
    result = analyzer.analyze("kazanciga");
    Assert.assertTrue(containsAllDictionaryLemma(result, "kazan"));
    result = analyzer.analyze("kazançiğimizdan");
    Assert.assertTrue(containsAllDictionaryLemma(result, "kazan"));
    result = analyzer.analyze("ınsanların");
    Assert.assertTrue(containsAllDictionaryLemma(result, "insan"));
}
Also used : SingleAnalysis(zemberek.morphology.analysis.SingleAnalysis) RuleBasedAnalyzer(zemberek.morphology.analysis.RuleBasedAnalyzer) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 RuleBasedAnalyzer (zemberek.morphology.analysis.RuleBasedAnalyzer)1 SingleAnalysis (zemberek.morphology.analysis.SingleAnalysis)1