use of zemberek.morphology.lexicon.proto.LexiconProto.Dictionary in project zemberek-nlp by ahmetaa.
the class DictionarySerializer method save.
public static void save(RootLexicon lexicon, Path outPath) throws IOException {
Dictionary.Builder builder = Dictionary.newBuilder();
for (DictionaryItem item : lexicon.getAllItems()) {
builder.addItems(convertToProto(item));
}
Dictionary dictionary = builder.build();
if (outPath.toFile().exists()) {
Files.delete(outPath);
}
Files.write(outPath, dictionary.toByteArray(), StandardOpenOption.CREATE);
}
Aggregations