summaryrefslogtreecommitdiffstats
path: root/utils/segment/ngseg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/segment/ngseg.cpp')
-rw-r--r--utils/segment/ngseg.cpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/utils/segment/ngseg.cpp b/utils/segment/ngseg.cpp
index 25b9361..b0ec850 100644
--- a/utils/segment/ngseg.cpp
+++ b/utils/segment/ngseg.cpp
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <locale.h>
#include "pinyin_internal.h"
+#include "utils_helper.h"
/* n-gram based sentence segment. */
@@ -109,20 +110,8 @@ int main(int argc, char * argv[]){
/* init phrase index */
FacadePhraseIndex phrase_index;
- for (size_t i = 0; i < PHRASE_INDEX_LIBRARY_COUNT; ++i) {
- const char * bin_file = pinyin_phrase_files[i];
- if (NULL == bin_file)
- continue;
-
- chunk = new MemoryChunk;
- bool retval = chunk->load(bin_file);
- if (!retval) {
- fprintf(stderr, "open %s failed!\n", bin_file);
- exit(ENOENT);
- }
-
- phrase_index.load(i, chunk);
- }
+ if (!init_phrase_index(&phrase_index))
+ exit(ENOENT);
/* init bi-gram */
Bigram system_bigram;