summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-08-06 14:11:44 +0800
committerPeng Wu <alexepico@gmail.com>2011-08-06 14:11:44 +0800
commit6504338199d28764aae9a1cefe2e14cf02d4287e (patch)
tree5749215176c4952404e18e8e5b9e35c2f27db8f6 /utils
parent589b10be816c4264fc1663f4680e4d71861f1682 (diff)
downloadlibpinyin-6504338199d28764aae9a1cefe2e14cf02d4287e.tar.gz
libpinyin-6504338199d28764aae9a1cefe2e14cf02d4287e.tar.xz
libpinyin-6504338199d28764aae9a1cefe2e14cf02d4287e.zip
refine utils/storage
Diffstat (limited to 'utils')
-rw-r--r--utils/storage/export_interpolation.cpp6
-rw-r--r--utils/storage/gen_binary_files.cpp10
-rw-r--r--utils/storage/gen_pinyin_table.cpp4
-rw-r--r--utils/storage/import_interpolation.cpp12
4 files changed, 16 insertions, 16 deletions
diff --git a/utils/storage/export_interpolation.cpp b/utils/storage/export_interpolation.cpp
index 4d2ae61..0516079 100644
--- a/utils/storage/export_interpolation.cpp
+++ b/utils/storage/export_interpolation.cpp
@@ -41,18 +41,18 @@ bool end_data(FILE * output){
int main(int argc, char * argv[]){
FILE * output = stdout;
- const char * bigram_filename = "../../data/bigram.db";
+ const char * bigram_filename = "bigram.db";
FacadePhraseIndex phrase_index;
//gb_char binary file
MemoryChunk * chunk = new MemoryChunk;
- chunk->load("../../data/gb_char.bin");
+ chunk->load("gb_char.bin");
phrase_index.load(1, chunk);
//gbk_char binary file
chunk = new MemoryChunk;
- chunk->load("../../data/gbk_char.bin");
+ chunk->load("gbk_char.bin");
phrase_index.load(2, chunk);
Bigram bigram;
diff --git a/utils/storage/gen_binary_files.cpp b/utils/storage/gen_binary_files.cpp
index 14aa973..90bc0c0 100644
--- a/utils/storage/gen_binary_files.cpp
+++ b/utils/storage/gen_binary_files.cpp
@@ -29,7 +29,7 @@ void print_help(){
int main(int argc, char * argv[]){
int i = 1;
- const char * table_dir = "../../data";
+ const char * table_dir = ".";
setlocale(LC_ALL, "");
while ( i < argc ){
@@ -90,24 +90,24 @@ int main(int argc, char * argv[]){
MemoryChunk * new_chunk = new MemoryChunk;
pinyinlargetable.store(new_chunk);
- new_chunk->save("../../data/pinyin_index.bin");
+ new_chunk->save("pinyin_index.bin");
pinyinlargetable.load(new_chunk);
new_chunk = new MemoryChunk;
phraselargetable.store(new_chunk);
- new_chunk->save("../../data/phrase_index.bin");
+ new_chunk->save("phrase_index.bin");
phraselargetable.load(new_chunk);
phrase_index.compat();
new_chunk = new MemoryChunk;
phrase_index.store(1, new_chunk);
- new_chunk->save("../../data/gb_char.bin");
+ new_chunk->save("gb_char.bin");
phrase_index.load(1, new_chunk);
new_chunk = new MemoryChunk;
phrase_index.store(2, new_chunk);
- new_chunk->save("../../data/gbk_char.bin");
+ new_chunk->save("gbk_char.bin");
phrase_index.load(2, new_chunk);
return 0;
diff --git a/utils/storage/gen_pinyin_table.cpp b/utils/storage/gen_pinyin_table.cpp
index 149e492..c6f7bff 100644
--- a/utils/storage/gen_pinyin_table.cpp
+++ b/utils/storage/gen_pinyin_table.cpp
@@ -72,7 +72,7 @@ gint phrase_item_compare(gconstpointer a, gconstpointer b){
}
int main(int argc, char * argv[]){
- char outfilename[1024]="temp.out";
+ char * outfilename = "temp.out";
int phrase_index = 0;
int i = 1;
@@ -94,7 +94,7 @@ int main(int argc, char * argv[]){
print_help();
exit(EINVAL);
}
- strcpy( outfilename, argv[i]);
+ outfilename = g_strdup(argv[i]);
} else {
feed_file(argv[i]);
}
diff --git a/utils/storage/import_interpolation.cpp b/utils/storage/import_interpolation.cpp
index ff4f638..221048d 100644
--- a/utils/storage/import_interpolation.cpp
+++ b/utils/storage/import_interpolation.cpp
@@ -194,24 +194,24 @@ bool parse_bigram(FILE * input, PhraseLargeTable * phrases,
int main(int argc, char * argv[]){
FILE * input = stdin;
- const char * bigram_filename = "../../data/bigram.db";
+ const char * bigram_filename = "bigram.db";
PhraseLargeTable phrases;
MemoryChunk * chunk = new MemoryChunk;
- chunk->load("../../data/phrase_index.bin");
+ chunk->load("phrase_index.bin");
phrases.load(chunk);
FacadePhraseIndex phrase_index;
//gb_char binary file
chunk = new MemoryChunk;
- chunk->load("../../data/gb_char.bin");
+ chunk->load("gb_char.bin");
phrase_index.load(1, chunk);
//gbk_char binary file
chunk = new MemoryChunk;
- chunk->load("../../data/gbk_char.bin");
+ chunk->load("gbk_char.bin");
phrase_index.load(2, chunk);
Bigram bigram;
@@ -252,12 +252,12 @@ int main(int argc, char * argv[]){
chunk = new MemoryChunk;
phrase_index.store(1, chunk);
- chunk->save("../../data/gb_char.bin");
+ chunk->save("gb_char.bin");
phrase_index.load(1, chunk);
chunk = new MemoryChunk;
phrase_index.store(2, chunk);
- chunk->save("../../data/gbk_char.bin");
+ chunk->save("gbk_char.bin");
phrase_index.load(2, chunk);
return 0;