summaryrefslogtreecommitdiffstats
path: root/utils/storage
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-05-16 14:59:05 +0800
committerPeng Wu <alexepico@gmail.com>2011-05-16 14:59:05 +0800
commit2b3ff42b8795a2b4644c3983568a33d63baf984b (patch)
tree8b1f84f4750d9caa4ae854a3ed2a5d3ba6fdddf8 /utils/storage
parent5bf8ae9ab5f227ec14d0d7cd671c491189733a94 (diff)
downloadlibpinyin-2b3ff42b8795a2b4644c3983568a33d63baf984b.tar.gz
libpinyin-2b3ff42b8795a2b4644c3983568a33d63baf984b.tar.xz
libpinyin-2b3ff42b8795a2b4644c3983568a33d63baf984b.zip
refine export interpolation
Diffstat (limited to 'utils/storage')
-rw-r--r--utils/storage/export_interpolation.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/utils/storage/export_interpolation.cpp b/utils/storage/export_interpolation.cpp
index 23e4d4a..69d3b3d 100644
--- a/utils/storage/export_interpolation.cpp
+++ b/utils/storage/export_interpolation.cpp
@@ -27,15 +27,17 @@
/* export interpolation model as textual format */
-void gen_unigram(FILE * output, FacadePhraseIndex * phrase_index);
-void gen_bigram(FILE * output, FacadePhraseIndex * phrase_index, Bigram * bigram);
+bool gen_unigram(FILE * output, FacadePhraseIndex * phrase_index);
+bool gen_bigram(FILE * output, FacadePhraseIndex * phrase_index, Bigram * bigram);
-void begin_data(FILE * output){
+bool begin_data(FILE * output){
fprintf(output, "\\data model interpolation\n");
+ return true;
}
-void end_data(FILE * output){
+bool end_data(FILE * output){
fprintf(output, "\\end\n");
+ return true;
}
int main(int argc, char * argv[]){
@@ -66,7 +68,7 @@ int main(int argc, char * argv[]){
return 0;
}
-void gen_unigram(FILE * output, FacadePhraseIndex * phrase_index) {
+bool gen_unigram(FILE * output, FacadePhraseIndex * phrase_index) {
fprintf(output, "\\1-gram\n");
for ( size_t i = 0; i < PHRASE_INDEX_LIBRARY_COUNT; i++) {
@@ -91,9 +93,10 @@ void gen_unigram(FILE * output, FacadePhraseIndex * phrase_index) {
g_free(phrase);
}
}
+ return true;
}
-void gen_bigram(FILE * output, FacadePhraseIndex * phrase_index, Bigram * bigram){
+bool gen_bigram(FILE * output, FacadePhraseIndex * phrase_index, Bigram * bigram){
fprintf(output, "\\2-gram\n");
/* Retrieve all user items. */
@@ -127,4 +130,5 @@ void gen_bigram(FILE * output, FacadePhraseIndex * phrase_index, Bigram * bigram
}
g_array_free(items, TRUE);
+ return true;
}