summaryrefslogtreecommitdiff
path: root/utils/segment
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-04-10 14:20:19 +0800
committerPeng Wu <alexepico@gmail.com>2013-04-10 14:20:19 +0800
commit429090fb1a486f0d71fe7cf8a16b4e4d26161202 (patch)
treefc237075a1f58f42777349b36d7ba6597a43ebbc /utils/segment
parentd425f10801bc7d593c9464f25c9f84525972caeb (diff)
downloadlibpinyin-429090fb1a486f0d71fe7cf8a16b4e4d26161202.tar.gz
update utils/segment
Diffstat (limited to 'utils/segment')
-rw-r--r--utils/segment/ngseg.cpp14
-rw-r--r--utils/segment/spseg.cpp14
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;