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