Search in sources :

Example 6 with TurkishDictionaryLoader

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

the class CompoundWordsTest 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 7 with TurkishDictionaryLoader

use of zemberek.morphology.lexicon.tr.TurkishDictionaryLoader 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 8 with TurkishDictionaryLoader

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

the class ParseConsole method addTextDictionaryResources.

public static RootLexicon addTextDictionaryResources(String... resources) throws IOException {
    RootLexicon lexicon = new RootLexicon();
    Log.info("Dictionaries :%s", String.join(", ", Arrays.asList(resources)));
    List<String> lines = new ArrayList<>();
    for (String resource : resources) {
        lines.addAll(Resources.readLines(Resources.getResource(resource), Charsets.UTF_8));
    }
    lexicon.addAll(new TurkishDictionaryLoader().load(lines));
    Log.info("Lexicon Generated.");
    return lexicon;
}
Also used : TurkishDictionaryLoader(zemberek.morphology.lexicon.tr.TurkishDictionaryLoader) ArrayList(java.util.ArrayList) RootLexicon(zemberek.morphology.lexicon.RootLexicon)

Example 9 with TurkishDictionaryLoader

use of zemberek.morphology.lexicon.tr.TurkishDictionaryLoader 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 10 with TurkishDictionaryLoader

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

the class SimpleGeneratorTest method getLexicon.

private DynamicLexiconGraph getLexicon() throws IOException {
    RootLexicon items = new TurkishDictionaryLoader().load(new File(Resources.getResource("dev-lexicon.txt").getFile()));
    DynamicLexiconGraph graph = new DynamicLexiconGraph(suffixProvider);
    graph.addDictionaryItems(items);
    return graph;
}
Also used : TurkishDictionaryLoader(zemberek.morphology.lexicon.tr.TurkishDictionaryLoader) RootLexicon(zemberek.morphology.lexicon.RootLexicon) File(java.io.File) DynamicLexiconGraph(zemberek.morphology.lexicon.graph.DynamicLexiconGraph)

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