update tests/lookup
authorPeng Wu <alexepico@gmail.com>
Wed, 10 Apr 2013 05:49:41 +0000 (13:49 +0800)
committerPeng Wu <alexepico@gmail.com>
Wed, 10 Apr 2013 05:49:41 +0000 (13:49 +0800)
tests/lookup/test_phrase_lookup.cpp
tests/lookup/test_pinyin_lookup.cpp

index 57bcf90..36a070d 100644 (file)
@@ -51,18 +51,28 @@ bool try_phrase_lookup(PhraseLookup * phrase_lookup,
 }
 
 int main(int argc, char * argv[]){
-
     setlocale(LC_ALL, "");
 
+    SystemTableInfo system_table_info;
+
+    bool retval = system_table_info.load("../../data/table.conf");
+    if (!retval) {
+        fprintf(stderr, "load table.conf failed.\n");
+        exit(ENOENT);
+    }
+
     /* init phrase table */
     FacadePhraseTable2 phrase_table;
     MemoryChunk * chunk = new MemoryChunk;
     chunk->load("../../data/phrase_index.bin");
     phrase_table.load(chunk, NULL);
 
+    const pinyin_table_info_t * phrase_files =
+        system_table_info.get_table_info();
+
     /* init phrase index */
     FacadePhraseIndex phrase_index;
-    if (!load_phrase_index(&phrase_index))
+    if (!load_phrase_index(phrase_files, &phrase_index))
         exit(ENOENT);
 
     /* init bi-gram */
index 3c714b9..446d8fd 100644 (file)
 size_t bench_times = 100;
 
 int main( int argc, char * argv[]){
+    SystemTableInfo system_table_info;
+
+    bool retval = system_table_info.load("../../data/table.conf");
+    if (!retval) {
+        fprintf(stderr, "load table.conf failed.\n");
+        exit(ENOENT);
+    }
 
     pinyin_option_t options =
         USE_TONE | USE_RESPLIT_TABLE | PINYIN_CORRECT_ALL | PINYIN_AMB_ALL;
@@ -37,8 +44,11 @@ int main( int argc, char * argv[]){
     chunk->load("../../data/pinyin_index.bin");
     largetable.load(options, chunk, NULL);
 
+    const pinyin_table_info_t * phrase_files =
+        system_table_info.get_table_info();
+
     FacadePhraseIndex phrase_index;
-    if (!load_phrase_index(&phrase_index))
+    if (!load_phrase_index(phrase_files, &phrase_index))
         exit(ENOENT);
 
     Bigram system_bigram;