Search in sources :

Example 11 with DynamicLexiconGraph

use of zemberek.morphology.lexicon.graph.DynamicLexiconGraph in project zemberek-nlp by ahmetaa.

the class WordAnalysisTest method getParser.

private WordAnalyzer getParser(String... lines) {
    DynamicLexiconGraph graph = new DynamicLexiconGraph(suffixProvider);
    graph.addDictionaryItems(new TurkishDictionaryLoader().load(lines));
    return new WordAnalyzer(graph);
}
Also used : TurkishDictionaryLoader(zemberek.morphology.lexicon.tr.TurkishDictionaryLoader) DynamicLexiconGraph(zemberek.morphology.lexicon.graph.DynamicLexiconGraph)

Example 12 with DynamicLexiconGraph

use of zemberek.morphology.lexicon.graph.DynamicLexiconGraph in project zemberek-nlp by ahmetaa.

the class WordAnalyzerFunctionalTest method getLexiconGraph.

private DynamicLexiconGraph getLexiconGraph(File... dictionaries) throws IOException {
    SuffixProvider suffixProvider = suffixes;
    RootLexicon lexicon = new RootLexicon();
    for (File dictionary : dictionaries) {
        new TurkishDictionaryLoader().loadInto(lexicon, dictionary);
    }
    DynamicLexiconGraph graph = new DynamicLexiconGraph(suffixProvider);
    graph.addDictionaryItems(lexicon);
    return graph;
}
Also used : SuffixProvider(zemberek.morphology.lexicon.SuffixProvider) TurkishDictionaryLoader(zemberek.morphology.lexicon.tr.TurkishDictionaryLoader) RootLexicon(zemberek.morphology.lexicon.RootLexicon) File(java.io.File) DynamicLexiconGraph(zemberek.morphology.lexicon.graph.DynamicLexiconGraph)

Example 13 with DynamicLexiconGraph

use of zemberek.morphology.lexicon.graph.DynamicLexiconGraph in project zemberek-nlp by ahmetaa.

the class WordAnalyzerTest method getLexiconGraph.

private DynamicLexiconGraph getLexiconGraph(String... words) {
    SuffixProvider suffixProvider = new NounSuffixes();
    List<DictionaryItem> items = getItems(words);
    DynamicLexiconGraph graph = new DynamicLexiconGraph(suffixProvider);
    graph.addDictionaryItems(items);
    return graph;
}
Also used : DynamicSuffixProvider(zemberek.morphology.lexicon.graph.DynamicSuffixProvider) SuffixProvider(zemberek.morphology.lexicon.SuffixProvider) DictionaryItem(zemberek.morphology.lexicon.DictionaryItem) DynamicLexiconGraph(zemberek.morphology.lexicon.graph.DynamicLexiconGraph)

Example 14 with DynamicLexiconGraph

use of zemberek.morphology.lexicon.graph.DynamicLexiconGraph in project zemberek-nlp by ahmetaa.

the class WordAnalyzerTest method testDoubling.

@Test
public void testDoubling() {
    DynamicLexiconGraph graph = getLexiconGraph("ret [A:Voicing, Doubling]");
    assertHasParses(graph, "ret", "retler", "redde");
    assertUnParseable(graph, "rede", "rete", "redler", "red");
}
Also used : DynamicLexiconGraph(zemberek.morphology.lexicon.graph.DynamicLexiconGraph) Test(org.junit.Test)

Example 15 with DynamicLexiconGraph

use of zemberek.morphology.lexicon.graph.DynamicLexiconGraph in project zemberek-nlp by ahmetaa.

the class WordAnalyzerTest method testCompounds.

@Test
public void testCompounds() {
    DynamicLexiconGraph graph = getLexiconGraph("zeytinyağı [A:CompoundP3sg ;Roots:zeytin-yağ]");
    assertHasParses(graph, "zeytinyağım", "zeytinyağına", "zeytinyağı", "zeytinyağcık", "zeytinyağcığa", "zeytinyağlarım");
    assertUnParseable(graph, "zeytinyağıcık", "zeytinyağılar");
}
Also used : DynamicLexiconGraph(zemberek.morphology.lexicon.graph.DynamicLexiconGraph) Test(org.junit.Test)

Aggregations

DynamicLexiconGraph (zemberek.morphology.lexicon.graph.DynamicLexiconGraph)20 Test (org.junit.Test)14 File (java.io.File)5 WordAnalysis (zemberek.morphology.analysis.WordAnalysis)5 WordAnalyzer (zemberek.morphology.analysis.WordAnalyzer)5 SimpleGenerator (zemberek.morphology.generator.SimpleGenerator)5 TurkishDictionaryLoader (zemberek.morphology.lexicon.tr.TurkishDictionaryLoader)5 RootLexicon (zemberek.morphology.lexicon.RootLexicon)3 SuffixProvider (zemberek.morphology.lexicon.SuffixProvider)3 ArrayList (java.util.ArrayList)2 Ignore (org.junit.Ignore)1 DictionaryItem (zemberek.morphology.lexicon.DictionaryItem)1 Suffix (zemberek.morphology.lexicon.Suffix)1 DynamicSuffixProvider (zemberek.morphology.lexicon.graph.DynamicSuffixProvider)1 TurkishSuffixes (zemberek.morphology.lexicon.tr.TurkishSuffixes)1 WordParser (zemberek.morphology.parser.WordParser)1