diff options
Diffstat (limited to 'utils/training')
-rw-r--r-- | utils/training/gen_ngram.cpp | 11 | ||||
-rw-r--r-- | utils/training/gen_unigram.cpp | 11 |
2 files changed, 4 insertions, 18 deletions
diff --git a/utils/training/gen_ngram.cpp b/utils/training/gen_ngram.cpp index 5721ce7..20b160c 100644 --- a/utils/training/gen_ngram.cpp +++ b/utils/training/gen_ngram.cpp @@ -130,15 +130,8 @@ int main(int argc, char * argv[]){ free(linebuf); - MemoryChunk * new_chunk = new MemoryChunk; - phrase_index.store(1, new_chunk); - new_chunk->save("gb_char.bin"); - phrase_index.load(1, new_chunk); - - new_chunk = new MemoryChunk; - phrase_index.store(2, new_chunk); - new_chunk->save("gbk_char.bin"); - phrase_index.load(2, new_chunk); + if (!save_phrase_index(&phrase_index)) + exit(ENOENT); return 0; } diff --git a/utils/training/gen_unigram.cpp b/utils/training/gen_unigram.cpp index 470a60a..f94c214 100644 --- a/utils/training/gen_unigram.cpp +++ b/utils/training/gen_unigram.cpp @@ -52,15 +52,8 @@ int main(int argc, char * argv[]){ } #endif - MemoryChunk * new_chunk = new MemoryChunk; - phrase_index.store(1, new_chunk); - new_chunk->save("gb_char.bin"); - phrase_index.load(1, new_chunk); - - new_chunk = new MemoryChunk; - phrase_index.store(2, new_chunk); - new_chunk->save("gbk_char.bin"); - phrase_index.load(2, new_chunk); + if (!save_phrase_index(&phrase_index)) + exit(ENOENT); return 0; } |