summaryrefslogtreecommitdiffstats
path: root/utils/storage
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2010-09-07 14:15:41 +0800
committerPeng Wu <alexepico@gmail.com>2010-09-07 14:15:41 +0800
commit673e351de76478a80d051d592212b93570134de7 (patch)
treee4431524a459957dcab1af00cab2500470bb0d9c /utils/storage
parentcafe087c0776a90bd49e917d139dd946fb22a464 (diff)
downloadlibpinyin-673e351de76478a80d051d592212b93570134de7.tar.gz
libpinyin-673e351de76478a80d051d592212b93570134de7.tar.xz
libpinyin-673e351de76478a80d051d592212b93570134de7.zip
add generating phrase index file
Diffstat (limited to 'utils/storage')
-rw-r--r--utils/storage/gen_binary_files.cpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/utils/storage/gen_binary_files.cpp b/utils/storage/gen_binary_files.cpp
index e930b87..5e7f619 100644
--- a/utils/storage/gen_binary_files.cpp
+++ b/utils/storage/gen_binary_files.cpp
@@ -26,33 +26,47 @@
#include "pinyin_phrase.h"
#include "pinyin_large_table.h"
#include "phrase_index.h"
+#include "phrase_large_table.h"
int main(int argc, char * argv[]){
/* generate pinyin index*/
PinyinCustomSettings custom;
- PinyinLargeTable largetable(&custom);
+ PinyinLargeTable pinyinlargetable(&custom);
+ PhraseLargeTable phraselargetable;
FILE * gbfile = fopen("../../data/gb_char.table", "r");
if ( gbfile == NULL) {
printf("open gb_char.table failed!");
return 1;
}
+
+ pinyinlargetable.load_text(gbfile);
+
+ fseek(gbfile, 0L, SEEK_SET);
+ phraselargetable.load_text(gbfile);
+ fclose(gbfile);
+
FILE * gbkfile = fopen("../../data/gbk_char.table","r");
if ( gbkfile == NULL) {
printf("open gb_char.table failed!");
return 1;
}
- largetable.load_text(gbfile);
- fclose(gbfile);
- largetable.load_text(gbkfile);
+ pinyinlargetable.load_text(gbkfile);
+
+ fseek(gbkfile, 0L, SEEK_SET);
+ phraselargetable.load_text(gbkfile);
fclose(gbkfile);
MemoryChunk * new_chunk = new MemoryChunk;
- largetable.store(new_chunk);
+ pinyinlargetable.store(new_chunk);
new_chunk->save("../../data/pinyin_index.bin");
- largetable.load(new_chunk);
+ pinyinlargetable.load(new_chunk);
+ new_chunk = new MemoryChunk;
+ phraselargetable.store(new_chunk);
+ new_chunk->save("../../data/phrase_index.bin");
+ phraselargetable.load(new_chunk);
/* generate phrase index*/
FacadePhraseIndex phrase_index;