diff options
author | Peng Wu <alexepico@gmail.com> | 2016-03-30 15:18:15 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2016-03-30 15:18:15 +0800 |
commit | 71bfcb74f432e0d2ea067da53cdc765f54c2e36c (patch) | |
tree | 32625cf7c5992fec008f0f0a9bc9dadc17599fbf /utils/storage | |
parent | 43360fcb6129e0c27ed7086b600b8699b8bdbd37 (diff) | |
download | libpinyin-71bfcb74f432e0d2ea067da53cdc765f54c2e36c.tar.gz libpinyin-71bfcb74f432e0d2ea067da53cdc765f54c2e36c.tar.xz libpinyin-71bfcb74f432e0d2ea067da53cdc765f54c2e36c.zip |
update utils
Diffstat (limited to 'utils/storage')
-rw-r--r-- | utils/storage/gen_binary_files.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/utils/storage/gen_binary_files.cpp b/utils/storage/gen_binary_files.cpp index 5d7e780..8ffb5fc 100644 --- a/utils/storage/gen_binary_files.cpp +++ b/utils/storage/gen_binary_files.cpp @@ -37,9 +37,12 @@ bool generate_binary_files(const char * pinyin_table_filename, const pinyin_table_info_t * phrase_files) { /* generate pinyin index*/ pinyin_option_t options = USE_TONE; - ChewingLargeTable chewing_table(options); + ChewingLargeTable2 pinyin_table; + pinyin_table.attach(pinyin_table_filename, ATTACH_READWRITE|ATTACH_CREATE); + PhraseLargeTable3 phrase_table; phrase_table.attach(phrase_table_filename, ATTACH_READWRITE|ATTACH_CREATE); + /* generate phrase index */ FacadePhraseIndex phrase_index; @@ -61,7 +64,7 @@ bool generate_binary_files(const char * pinyin_table_filename, exit(ENOENT); } - chewing_table.load_text(tablefile); + pinyin_table.load_text(tablefile); fseek(tablefile, 0L, SEEK_SET); phrase_table.load_text(tablefile); fseek(tablefile, 0L, SEEK_SET); @@ -70,11 +73,6 @@ bool generate_binary_files(const char * pinyin_table_filename, g_free(filename); } - MemoryChunk * new_chunk = new MemoryChunk; - chewing_table.store(new_chunk); - new_chunk->save(pinyin_table_filename); - chewing_table.load(new_chunk); - phrase_index.compact(); if (!save_phrase_index(phrase_files, &phrase_index)) |