summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-03-30 15:18:15 +0800
committerPeng Wu <alexepico@gmail.com>2016-03-30 15:18:15 +0800
commit71bfcb74f432e0d2ea067da53cdc765f54c2e36c (patch)
tree32625cf7c5992fec008f0f0a9bc9dadc17599fbf /utils
parent43360fcb6129e0c27ed7086b600b8699b8bdbd37 (diff)
downloadlibpinyin-71bfcb74f432e0d2ea067da53cdc765f54c2e36c.zip
libpinyin-71bfcb74f432e0d2ea067da53cdc765f54c2e36c.tar.gz
libpinyin-71bfcb74f432e0d2ea067da53cdc765f54c2e36c.tar.xz
update utils
Diffstat (limited to 'utils')
-rw-r--r--utils/storage/gen_binary_files.cpp12
-rw-r--r--utils/training/eval_correction_rate.cpp4
-rw-r--r--utils/training/gen_deleted_ngram.cpp6
3 files changed, 7 insertions, 15 deletions
diff --git a/utils/storage/gen_binary_files.cpp b/utils/storage/gen_binary_files.cpp
index 5d7e780..8ffb5fc 100644
--- a/utils/storage/gen_binary_files.cpp
+++ b/utils/storage/gen_binary_files.cpp
@@ -37,9 +37,12 @@ bool generate_binary_files(const char * pinyin_table_filename,
const pinyin_table_info_t * phrase_files) {
/* generate pinyin index*/
pinyin_option_t options = USE_TONE;
- ChewingLargeTable chewing_table(options);
+ ChewingLargeTable2 pinyin_table;
+ pinyin_table.attach(pinyin_table_filename, ATTACH_READWRITE|ATTACH_CREATE);
+
PhraseLargeTable3 phrase_table;
phrase_table.attach(phrase_table_filename, ATTACH_READWRITE|ATTACH_CREATE);
+
/* generate phrase index */
FacadePhraseIndex phrase_index;
@@ -61,7 +64,7 @@ bool generate_binary_files(const char * pinyin_table_filename,
exit(ENOENT);
}
- chewing_table.load_text(tablefile);
+ pinyin_table.load_text(tablefile);
fseek(tablefile, 0L, SEEK_SET);
phrase_table.load_text(tablefile);
fseek(tablefile, 0L, SEEK_SET);
@@ -70,11 +73,6 @@ bool generate_binary_files(const char * pinyin_table_filename,
g_free(filename);
}
- MemoryChunk * new_chunk = new MemoryChunk;
- chewing_table.store(new_chunk);
- new_chunk->save(pinyin_table_filename);
- chewing_table.load(new_chunk);
-
phrase_index.compact();
if (!save_phrase_index(phrase_files, &phrase_index))
diff --git a/utils/training/eval_correction_rate.cpp b/utils/training/eval_correction_rate.cpp
index 633419f..f2bfadf 100644
--- a/utils/training/eval_correction_rate.cpp
+++ b/utils/training/eval_correction_rate.cpp
@@ -125,9 +125,9 @@ int main(int argc, char * argv[]){
}
pinyin_option_t options = USE_TONE;
- FacadeChewingTable largetable;
- largetable.load(options, SYSTEM_PINYIN_INDEX, NULL);
+ FacadeChewingTable2 largetable;
+ largetable.load(SYSTEM_PINYIN_INDEX, NULL);
FacadePhraseIndex phrase_index;
diff --git a/utils/training/gen_deleted_ngram.cpp b/utils/training/gen_deleted_ngram.cpp
index 40f9f5a..b0d0254 100644
--- a/utils/training/gen_deleted_ngram.cpp
+++ b/utils/training/gen_deleted_ngram.cpp
@@ -59,12 +59,6 @@ int main(int argc, char * argv[]){
exit(ENOENT);
}
- /* load phrase table. */
- PhraseLargeTable3 phrase_table;
- MemoryChunk * new_chunk = new MemoryChunk;
- new_chunk->load(SYSTEM_PHRASE_INDEX);
- phrase_table.load(new_chunk);
-
FacadePhraseIndex phrase_index;
const pinyin_table_info_t * phrase_files =