diff options
author | Peng Wu <alexepico@gmail.com> | 2013-04-10 14:34:02 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2013-04-10 14:34:02 +0800 |
commit | 8045de6d4af0594344f8e9116368b02048a06eb5 (patch) | |
tree | b1125044709f343dba89d03a26265e1dcc597b45 /utils/training | |
parent | 865b5c981d6574e21efa58944182ceb67287eced (diff) | |
download | libpinyin-8045de6d4af0594344f8e9116368b02048a06eb5.tar.gz libpinyin-8045de6d4af0594344f8e9116368b02048a06eb5.tar.xz libpinyin-8045de6d4af0594344f8e9116368b02048a06eb5.zip |
update gen_ngram.cpp
Diffstat (limited to 'utils/training')
-rw-r--r-- | utils/training/gen_ngram.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/utils/training/gen_ngram.cpp b/utils/training/gen_ngram.cpp index cb8d04c..b8e3bd1 100644 --- a/utils/training/gen_ngram.cpp +++ b/utils/training/gen_ngram.cpp @@ -51,7 +51,15 @@ int main(int argc, char * argv[]){ g_print("option parsing failed:%s\n", error->message); 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); + } + PhraseLargeTable2 phrase_table; /* init phrase table */ MemoryChunk * chunk = new MemoryChunk; @@ -59,7 +67,11 @@ int main(int argc, char * argv[]){ phrase_table.load(chunk); FacadePhraseIndex phrase_index; - if (!load_phrase_index(&phrase_index)) + + const pinyin_table_info_t * phrase_files = + system_table_info.get_table_info(); + + if (!load_phrase_index(phrase_files, &phrase_index)) exit(ENOENT); Bigram bigram; @@ -117,7 +129,7 @@ int main(int argc, char * argv[]){ free(linebuf); - if (!save_phrase_index(&phrase_index)) + if (!save_phrase_index(phrase_files, &phrase_index)) exit(ENOENT); return 0; |