use of zemberek.morphology.lexicon.SuffixProvider in project lucene-solr-analysis-turkish by iorixxx.
the class Zemberek3StemFilterFactory method inform.
@Override
public void inform(ResourceLoader loader) throws IOException {
if (dictionaryFiles == null || dictionaryFiles.trim().isEmpty()) {
this.parser = TurkishWordParserGenerator.createWithDefaults().getParser();
// Use default dictionaries shipped with Zemberek3.
return;
}
List<String> lines = new ArrayList<>();
List<String> files = splitFileNames(dictionaryFiles);
if (files.size() > 0) {
for (String file : files) {
List<String> wlist = getLines(loader, file.trim());
lines.addAll(wlist);
}
}
if (lines.isEmpty()) {
this.parser = TurkishWordParserGenerator.createWithDefaults().getParser();
// Use default dictionaries shipped with Zemberek3.
return;
}
SuffixProvider suffixProvider = new TurkishSuffixes();
RootLexicon lexicon = new TurkishDictionaryLoader(suffixProvider).load(lines);
DynamicLexiconGraph graph = new DynamicLexiconGraph(suffixProvider);
graph.addDictionaryItems(lexicon);
parser = new WordParser(graph);
}
use of zemberek.morphology.lexicon.SuffixProvider 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.SuffixProvider 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;
}
Aggregations