From 981d12ddb3610e4ca63423572651e3f667fa0073 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Thu, 17 May 2012 14:30:53 +0800 Subject: update ngseg.cpp --- utils/segment/ngseg.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'utils/segment') diff --git a/utils/segment/ngseg.cpp b/utils/segment/ngseg.cpp index 8de2f0c..ae87305 100644 --- a/utils/segment/ngseg.cpp +++ b/utils/segment/ngseg.cpp @@ -109,12 +109,16 @@ int main(int argc, char * argv[]){ /* init phrase index */ FacadePhraseIndex phrase_index; - chunk = new MemoryChunk; - chunk->load("gb_char.bin"); - phrase_index.load(1, chunk); - chunk = new MemoryChunk; - chunk->load("gbk_char.bin"); - phrase_index.load(2, chunk); + for (size_t i = 0; i < PHRASE_INDEX_LIBRARY_COUNT; ++i) { + const char * bin_file = pinyin_phrase_files[i]; + if (NULL == bin_file) + continue; + gchar * filename = g_build_filename("..", "..", "data", bin_file,NULL); + chunk = new MemoryChunk; + chunk->load(filename); + phrase_index.load(i, chunk); + g_free(filename); + } /* init bi-gram */ Bigram system_bigram; -- cgit