update utils/training
authorPeng Wu <alexepico@gmail.com>
Wed, 10 Apr 2013 06:41:15 +0000 (14:41 +0800)
committerPeng Wu <alexepico@gmail.com>
Wed, 10 Apr 2013 06:41:15 +0000 (14:41 +0800)
utils/training/estimate_interpolation.cpp
utils/training/eval_correction_rate.cpp
utils/training/export_k_mixture_model.cpp
utils/training/gen_deleted_ngram.cpp
utils/training/gen_k_mixture_model.cpp
utils/training/import_k_mixture_model.cpp

index 9d3a96f..15b1bdc 100644 (file)
@@ -89,8 +89,20 @@ parameter_t compute_interpolation(SingleGram * deleted_bigram,
 }
     
 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);
+    }
+
     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);
 
     Bigram bigram;
index dd4d434..a4d8f63 100644 (file)
@@ -116,6 +116,14 @@ bool do_one_test(PinyinLookup2 * pinyin_lookup,
 int main(int argc, char * argv[]){
     const char * evals_text = "evals2.text";
 
+    SystemTableInfo system_table_info;
+
+    bool retval = system_table_info.load("table.conf");
+    if (!retval) {
+        fprintf(stderr, "load table.conf failed.\n");
+        exit(ENOENT);
+    }
+
     pinyin_option_t options = USE_TONE;
     FacadeChewingTable largetable;
 
@@ -129,7 +137,11 @@ int main(int argc, char * argv[]){
     phrase_table.load(chunk, NULL);
 
     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);
 
     Bigram system_bigram;
index ddb971e..90ec2b5 100644 (file)
@@ -124,8 +124,20 @@ int main(int argc, char * argv[]){
         exit(EINVAL);
     }
 
+    SystemTableInfo system_table_info;
+
+    bool retval = system_table_info.load("table.conf");
+    if (!retval) {
+        fprintf(stderr, "load table.conf failed.\n");
+        exit(ENOENT);
+    }
+
     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);
 
     KMixtureModelBigram bigram(K_MIXTURE_MODEL_MAGIC_NUMBER);
index 0437a68..5044d92 100644 (file)
@@ -51,6 +51,14 @@ int main(int argc, char * argv[]){
         exit(EINVAL);
     }
 
+    SystemTableInfo system_table_info;
+
+    bool retval = system_table_info.load("table.conf");
+    if (!retval) {
+        fprintf(stderr, "load table.conf failed.\n");
+        exit(ENOENT);
+    }
+
     /* load phrase table. */
     PhraseLargeTable2 phrase_table;
     MemoryChunk * new_chunk = new MemoryChunk;
@@ -58,7 +66,11 @@ int main(int argc, char * argv[]){
     phrase_table.load(new_chunk);
 
     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(ENODATA);
 
     Bigram bigram;
index efa760d..915aa3a 100644 (file)
@@ -329,13 +329,25 @@ int main(int argc, char * argv[]){
         exit(EINVAL);
     }
 
+    SystemTableInfo system_table_info;
+
+    bool retval = system_table_info.load("table.conf");
+    if (!retval) {
+        fprintf(stderr, "load table.conf failed.\n");
+        exit(ENOENT);
+    }
+
     PhraseLargeTable2 phrase_table;
     MemoryChunk * chunk = new MemoryChunk;
     chunk->load("phrase_index.bin");
     phrase_table.load(chunk);
 
     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);
 
     KMixtureModelBigram bigram(K_MIXTURE_MODEL_MAGIC_NUMBER);
index f842764..168f6d1 100644 (file)
@@ -271,13 +271,25 @@ int main(int argc, char * argv[]){
         exit(EINVAL);
     }
 
+    SystemTableInfo system_table_info;
+
+    bool retval = system_table_info.load("table.conf");
+    if (!retval) {
+        fprintf(stderr, "load table.conf failed.\n");
+        exit(ENOENT);
+    }
+
     PhraseLargeTable2 phrase_table;
     MemoryChunk * chunk = new MemoryChunk;
     chunk->load("phrase_index.bin");
     phrase_table.load(chunk);
 
     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);
 
     KMixtureModelBigram bigram(K_MIXTURE_MODEL_MAGIC_NUMBER);