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);
}
}
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);
}
}
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));
}
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));
}
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));
}
Aggregations