diff options
author | Peng Wu <alexepico@gmail.com> | 2013-04-10 14:20:19 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2013-04-10 14:20:19 +0800 |
commit | 429090fb1a486f0d71fe7cf8a16b4e4d26161202 (patch) | |
tree | fc237075a1f58f42777349b36d7ba6597a43ebbc /utils/segment | |
parent | d425f10801bc7d593c9464f25c9f84525972caeb (diff) | |
download | libpinyin-429090fb1a486f0d71fe7cf8a16b4e4d26161202.tar.gz |
update utils/segment
Diffstat (limited to 'utils/segment')
-rw-r--r-- | utils/segment/ngseg.cpp | 14 | ||||
-rw-r--r-- | utils/segment/spseg.cpp | 14 |
2 files changed, 26 insertions, 2 deletions
diff --git a/utils/segment/ngseg.cpp b/utils/segment/ngseg.cpp index d74ec43..57cc164 100644 --- a/utils/segment/ngseg.cpp +++ b/utils/segment/ngseg.cpp @@ -134,6 +134,14 @@ int main(int argc, char * argv[]){ } } + SystemTableInfo system_table_info; + + bool retval = system_table_info.load("table.conf"); + if (!retval) { + fprintf(stderr, "load table.conf failed.\n"); + exit(ENOENT); + } + /* init phrase table */ FacadePhraseTable2 phrase_table; MemoryChunk * chunk = new MemoryChunk; @@ -142,7 +150,11 @@ int main(int argc, char * argv[]){ /* init phrase index */ 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); /* init bi-gram */ diff --git a/utils/segment/spseg.cpp b/utils/segment/spseg.cpp index 50dc5df..d37ddc7 100644 --- a/utils/segment/spseg.cpp +++ b/utils/segment/spseg.cpp @@ -189,6 +189,14 @@ int main(int argc, char * argv[]){ } } + SystemTableInfo system_table_info; + + bool retval = system_table_info.load("table.conf"); + if (!retval) { + fprintf(stderr, "load table.conf failed.\n"); + exit(ENOENT); + } + /* init phrase table */ FacadePhraseTable2 phrase_table; MemoryChunk * chunk = new MemoryChunk; @@ -197,7 +205,11 @@ int main(int argc, char * argv[]){ /* init phrase index */ 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); char * linebuf = NULL; size_t size = 0; ssize_t read; |