use of com.joliciel.jochre.lexicon.TextFileLexicon in project jochre by urieli.
the class JochreSession method readLexicon.
protected Lexicon readLexicon(File lexiconDir) {
Lexicon myLexicon = null;
if (lexiconDir.isDirectory()) {
LexiconMerger lexiconMerger = new LexiconMerger();
File[] lexiconFiles = lexiconDir.listFiles();
for (File lexiconFile : lexiconFiles) {
if (lexiconFile.getName().endsWith(".txt")) {
TextFileLexicon textFileLexicon = new TextFileLexicon(lexiconFile, this.encoding);
lexiconMerger.addLexicon(textFileLexicon);
} else {
Lexicon textFileLexicon = TextFileLexicon.deserialize(lexiconFile);
lexiconMerger.addLexicon(textFileLexicon);
}
}
myLexicon = lexiconMerger;
} else {
if (lexiconDir.getName().endsWith(".txt")) {
TextFileLexicon textFileLexicon = new TextFileLexicon(lexiconDir, this.encoding);
myLexicon = textFileLexicon;
} else {
Lexicon textFileLexicon = TextFileLexicon.deserialize(lexiconDir);
myLexicon = textFileLexicon;
}
}
return myLexicon;
}
Aggregations