diff options
author | Peng Wu <alexepico@gmail.com> | 2013-04-10 14:45:08 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2013-04-10 14:45:08 +0800 |
commit | 9ce3b3437d4e7164475aaf8efd00935f82ee3801 (patch) | |
tree | c38cd2ac5edbe699d877d38ece37a81bc2774233 | |
parent | 8f1b6d0c5574f1367fb4e154d7972ef40e05dcdd (diff) | |
download | libpinyin-9ce3b3437d4e7164475aaf8efd00935f82ee3801.tar.gz libpinyin-9ce3b3437d4e7164475aaf8efd00935f82ee3801.tar.xz libpinyin-9ce3b3437d4e7164475aaf8efd00935f82ee3801.zip |
update gen_binary_files.cpp
-rw-r--r-- | utils/storage/gen_binary_files.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/utils/storage/gen_binary_files.cpp b/utils/storage/gen_binary_files.cpp index bc874ba..21f9ea4 100644 --- a/utils/storage/gen_binary_files.cpp +++ b/utils/storage/gen_binary_files.cpp @@ -45,6 +45,14 @@ int main(int argc, char * argv[]){ exit(EINVAL); } + SystemTableInfo system_table_info; + + bool retval = system_table_info.load("table.conf"); + if (!retval) { + fprintf(stderr, "load table.conf failed.\n"); + exit(ENOENT); + } + /* generate pinyin index*/ pinyin_option_t options = USE_TONE; ChewingLargeTable chewing_table(options); @@ -52,8 +60,12 @@ int main(int argc, char * argv[]){ /* generate phrase index */ FacadePhraseIndex phrase_index; + + const pinyin_table_info_t * phrase_files = + system_table_info.get_table_info(); + for (size_t i = 0; i < PHRASE_INDEX_LIBRARY_COUNT; ++i) { - const pinyin_table_info_t * table_info = pinyin_phrase_files + i; + const pinyin_table_info_t * table_info = phrase_files + i; assert(table_info->m_dict_index == i); if (SYSTEM_FILE != table_info->m_file_type && @@ -91,10 +103,10 @@ int main(int argc, char * argv[]){ phrase_index.compact(); - if (!save_phrase_index(&phrase_index)) + if (!save_phrase_index(phrase_files, &phrase_index)) exit(ENOENT); - if (!save_dictionary(&phrase_index)) + if (!save_dictionary(phrase_files, &phrase_index)) exit(ENOENT); return 0; |