Search in sources :

Example 1 with RuleBasedDisambiguator

use of zemberek.morphology.ambiguity.RuleBasedDisambiguator in project zemberek-nlp by ahmetaa.

the class RuleBasedDisambiguatorTest method test.

@Test
public void test() throws IOException {
    // String input = "ABD Açık Serena Williams'ın";
    // String input = "Çünkü birbirine tezat oluşturuyor.";
    // String input = "O anda gördüm.";
    // String input = "Aklımıza ilk gelen emeği öncelemek.";
    // String input = "Petrolün Türkiye üzerinden dünya pazarına satılması.";
    String input = "4 Neden önemli?";
    // String input = "Sadece partimi iktidar yaptım.";
    TurkishMorphology analyzer = TurkishMorphology.createWithDefaults();
    // Rules rules = new Rules();
    // rules.pairLexRules.add(PairRule.fromLine("Aklı*|aklı* [akıl:Noun] *"));
    RuleBasedDisambiguator disambiguator = new RuleBasedDisambiguator(analyzer, Rules.fromResources());
    ResultSentence resultSentence = disambiguator.disambiguate(input);
    System.out.println(resultSentence.allIgnoredCount());
    for (AmbiguityAnalysis a : resultSentence.results) {
        a.getForTrainingOutput().forEach(System.out::println);
    }
}
Also used : AmbiguityAnalysis(zemberek.morphology.ambiguity.RuleBasedDisambiguator.AmbiguityAnalysis) ResultSentence(zemberek.morphology.ambiguity.RuleBasedDisambiguator.ResultSentence) TurkishMorphology(zemberek.morphology.TurkishMorphology) RuleBasedDisambiguator(zemberek.morphology.ambiguity.RuleBasedDisambiguator) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 TurkishMorphology (zemberek.morphology.TurkishMorphology)1 RuleBasedDisambiguator (zemberek.morphology.ambiguity.RuleBasedDisambiguator)1 AmbiguityAnalysis (zemberek.morphology.ambiguity.RuleBasedDisambiguator.AmbiguityAnalysis)1 ResultSentence (zemberek.morphology.ambiguity.RuleBasedDisambiguator.ResultSentence)1