Search in sources :

Example 11 with TurkishDictionaryLoader

use of zemberek.morphology.lexicon.tr.TurkishDictionaryLoader in project zemberek-nlp by ahmetaa.

the class TurkishDictionaryLoaderTest method nounAttributesTest.

@Test
public void nounAttributesTest() {
    TurkishDictionaryLoader loader = new TurkishDictionaryLoader();
    List<ItemAttrPair> testList = Lists.newArrayList(testPair("takat [A:NoVoicing, InverseHarmony]", NoVoicing, InverseHarmony), testPair("nakit [A: LastVowelDrop]", Voicing, LastVowelDrop), testPair("ret [A:Voicing, Doubling]", Voicing, Doubling));
    for (ItemAttrPair pair : testList) {
        DictionaryItem item = loader.loadFromString(pair.str);
        Assert.assertEquals(Noun, item.primaryPos);
        Assert.assertEquals("error in:" + pair.str, pair.attrs, item.attributes);
    }
}
Also used : TurkishDictionaryLoader(zemberek.morphology.lexicon.tr.TurkishDictionaryLoader) Test(org.junit.Test)

Example 12 with TurkishDictionaryLoader

use of zemberek.morphology.lexicon.tr.TurkishDictionaryLoader in project zemberek-nlp by ahmetaa.

the class TurkishDictionaryLoaderTest method nounVoicingTest.

@Test
public void nounVoicingTest() {
    TurkishDictionaryLoader loader = new TurkishDictionaryLoader();
    String[] voicing = { "kabak", "kabak [A:Voicing]", "psikolog", "havuç", "turp [A:Voicing]", "galip", "nohut", "cenk", "kükürt" };
    for (String s : voicing) {
        DictionaryItem item = loader.loadFromString(s);
        Assert.assertEquals(Noun, item.primaryPos);
        Assert.assertEquals("error in:" + s, EnumSet.of(RootAttribute.Voicing), item.attributes);
    }
    String[] novoicing = { "kek", "top", "kulp", "takat [A:NoVoicing]" };
    for (String s : novoicing) {
        DictionaryItem item = loader.loadFromString(s);
        Assert.assertEquals(Noun, item.primaryPos);
        Assert.assertEquals("error in:" + s, EnumSet.of(NoVoicing), item.attributes);
    }
}
Also used : TurkishDictionaryLoader(zemberek.morphology.lexicon.tr.TurkishDictionaryLoader) Test(org.junit.Test)

Example 13 with TurkishDictionaryLoader

use of zemberek.morphology.lexicon.tr.TurkishDictionaryLoader in project zemberek-nlp by ahmetaa.

the class TurkishDictionaryLoaderTest method referenceTest1.

@Test
public void referenceTest1() {
    TurkishDictionaryLoader loader = new TurkishDictionaryLoader();
    String[] ref = { "ad", "ad [A:Doubling,InverseHarmony]", "soy", "soyadı [A:CompoundP3sg; Roots:soy-ad]" };
    RootLexicon lexicon = loader.load(ref);
    DictionaryItem item = lexicon.getItemById("soyadı_Noun");
    Assert.assertNotNull(item);
    Assert.assertFalse(item.attributes.contains(RootAttribute.Doubling));
}
Also used : TurkishDictionaryLoader(zemberek.morphology.lexicon.tr.TurkishDictionaryLoader) Test(org.junit.Test)

Example 14 with TurkishDictionaryLoader

use of zemberek.morphology.lexicon.tr.TurkishDictionaryLoader in project zemberek-nlp by ahmetaa.

the class TurkishDictionaryLoaderTest method voicingInferenceTest.

@Test
public void voicingInferenceTest() {
    TurkishDictionaryLoader loader = new TurkishDictionaryLoader();
    DictionaryItem item = loader.loadFromString("aort [A:NoVoicing]");
    Assert.assertEquals("aort", item.root);
    Assert.assertEquals(Noun, item.primaryPos);
    Assert.assertTrue(item.hasAttribute(RootAttribute.NoVoicing));
    Assert.assertFalse(item.hasAttribute(RootAttribute.Voicing));
    item = loader.loadFromString("at");
    Assert.assertEquals("at", item.root);
    Assert.assertEquals(Noun, item.primaryPos);
    Assert.assertTrue(item.hasAttribute(RootAttribute.NoVoicing));
    Assert.assertFalse(item.hasAttribute(RootAttribute.Voicing));
}
Also used : TurkishDictionaryLoader(zemberek.morphology.lexicon.tr.TurkishDictionaryLoader) Test(org.junit.Test)

Example 15 with TurkishDictionaryLoader

use of zemberek.morphology.lexicon.tr.TurkishDictionaryLoader in project zemberek-nlp by ahmetaa.

the class TurkishDictionaryLoaderTest method referenceTest2.

@Test
public void referenceTest2() {
    TurkishDictionaryLoader loader = new TurkishDictionaryLoader();
    String[] ref = { "ad", "ad [A:Doubling,InverseHarmony;Index:1]", "soy", "soyadı [A:CompoundP3sg; Roots:soy-ad]" };
    RootLexicon lexicon = loader.load(ref);
    DictionaryItem item = lexicon.getItemById("soyadı_Noun");
    Assert.assertNotNull(item);
    Assert.assertFalse(item.attributes.contains(RootAttribute.Doubling));
}
Also used : TurkishDictionaryLoader(zemberek.morphology.lexicon.tr.TurkishDictionaryLoader) Test(org.junit.Test)

Aggregations

TurkishDictionaryLoader (zemberek.morphology.lexicon.tr.TurkishDictionaryLoader)17 Test (org.junit.Test)9 DynamicLexiconGraph (zemberek.morphology.lexicon.graph.DynamicLexiconGraph)5 File (java.io.File)4 ArrayList (java.util.ArrayList)4 RootLexicon (zemberek.morphology.lexicon.RootLexicon)4 Ignore (org.junit.Ignore)2 DictionaryItem (zemberek.morphology.lexicon.DictionaryItem)2 SuffixProvider (zemberek.morphology.lexicon.SuffixProvider)2 PrintWriter (java.io.PrintWriter)1 Path (java.nio.file.Path)1 HashSet (java.util.HashSet)1 Locale (java.util.Locale)1 TurkishAlphabet (zemberek.core.turkish.TurkishAlphabet)1 TurkishLetterSequence (zemberek.core.turkish.TurkishLetterSequence)1 TurkishMorphology (zemberek.morphology.TurkishMorphology)1 SingleAnalysis (zemberek.morphology.analysis.SingleAnalysis)1 WordAnalysis (zemberek.morphology.analysis.WordAnalysis)1 TurkishSuffixes (zemberek.morphology.lexicon.tr.TurkishSuffixes)1 WordParser (zemberek.morphology.parser.WordParser)1