summaryrefslogtreecommitdiffstats
path: root/utils/training
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-05-17 15:35:40 +0800
committerPeng Wu <alexepico@gmail.com>2012-05-17 15:35:40 +0800
commit0b7fc32237ebdadb5f049835c026b8c19fdee6a8 (patch)
tree1692f1914823c24cef9931d907eca5ed11726f79 /utils/training
parentd6b9035b82cd00e1763c715386cfa52621945716 (diff)
downloadlibpinyin-0b7fc32237ebdadb5f049835c026b8c19fdee6a8.tar.gz
libpinyin-0b7fc32237ebdadb5f049835c026b8c19fdee6a8.tar.xz
libpinyin-0b7fc32237ebdadb5f049835c026b8c19fdee6a8.zip
updates utils
Diffstat (limited to 'utils/training')
-rw-r--r--utils/training/estimate_interpolation.cpp5
-rw-r--r--utils/training/eval_correction_rate.cpp5
-rw-r--r--utils/training/export_k_mixture_model.cpp5
-rw-r--r--utils/training/gen_ngram.cpp6
-rw-r--r--utils/training/gen_unigram.cpp5
5 files changed, 5 insertions, 21 deletions
diff --git a/utils/training/estimate_interpolation.cpp b/utils/training/estimate_interpolation.cpp
index 5f5abae..cd2ef96 100644
--- a/utils/training/estimate_interpolation.cpp
+++ b/utils/training/estimate_interpolation.cpp
@@ -96,17 +96,14 @@ int main(int argc, char * argv[]){
if (NULL == bin_file)
continue;
- gchar * filename = g_build_filename("..", "..", "data",
- bin_file, NULL);
chunk = new MemoryChunk;
- bool retval = chunk->load(filename);
+ bool retval = chunk->load(bin_file);
if (!retval) {
fprintf(stderr, "open %s failed!\n", bin_file);
exit(ENOENT);
}
phrase_index.load(i, chunk);
- g_free(filename);
}
Bigram bigram;
diff --git a/utils/training/eval_correction_rate.cpp b/utils/training/eval_correction_rate.cpp
index 55fc3b0..ada160f 100644
--- a/utils/training/eval_correction_rate.cpp
+++ b/utils/training/eval_correction_rate.cpp
@@ -128,17 +128,14 @@ int main(int argc, char * argv[]){
if (NULL == bin_file)
continue;
- gchar * filename = g_build_filename("..", "..", "data",
- bin_file, NULL);
chunk = new MemoryChunk;
- bool retval = chunk->load(filename);
+ bool retval = chunk->load(bin_file);
if (!retval) {
fprintf(stderr, "open %s failed!\n", bin_file);
exit(ENOENT);
}
phrase_index.load(i, chunk);
- g_free(filename);
}
FacadePhraseTable phrases;
diff --git a/utils/training/export_k_mixture_model.cpp b/utils/training/export_k_mixture_model.cpp
index fd20a84..df09d24 100644
--- a/utils/training/export_k_mixture_model.cpp
+++ b/utils/training/export_k_mixture_model.cpp
@@ -131,17 +131,14 @@ int main(int argc, char * argv[]){
if (NULL == bin_file)
continue;
- gchar * filename = g_build_filename("..", "..", "data",
- bin_file, NULL);
chunk = new MemoryChunk;
- bool retval = chunk->load(filename);
+ bool retval = chunk->load(bin_file);
if (!retval) {
fprintf(stderr, "open %s failed!\n", bin_file);
exit(ENOENT);
}
phrase_index.load(i, chunk);
- g_free(filename);
}
KMixtureModelBigram bigram(K_MIXTURE_MODEL_MAGIC_NUMBER);
diff --git a/utils/training/gen_ngram.cpp b/utils/training/gen_ngram.cpp
index 8c2a31c..6de442b 100644
--- a/utils/training/gen_ngram.cpp
+++ b/utils/training/gen_ngram.cpp
@@ -68,23 +68,19 @@ int main(int argc, char * argv[]){
if (NULL == bin_file)
continue;
- gchar * filename = g_build_filename("..", "..", "data",
- bin_file, NULL);
chunk = new MemoryChunk;
- bool retval = chunk->load(filename);
+ bool retval = chunk->load(bin_file);
if (!retval) {
fprintf(stderr, "open %s failed!\n", bin_file);
exit(ENOENT);
}
phrase_index.load(i, chunk);
- g_free(filename);
}
Bigram bigram;
bigram.attach(bigram_filename, ATTACH_CREATE|ATTACH_READWRITE);
-
char* linebuf = NULL;
size_t size = 0;
phrase_token_t last_token, cur_token = last_token = 0;
diff --git a/utils/training/gen_unigram.cpp b/utils/training/gen_unigram.cpp
index 3f31a46..29a1bc6 100644
--- a/utils/training/gen_unigram.cpp
+++ b/utils/training/gen_unigram.cpp
@@ -34,17 +34,14 @@ int main(int argc, char * argv[]){
if (NULL == bin_file)
continue;
- gchar * filename = g_build_filename("..", "..", "data",
- bin_file, NULL);
chunk = new MemoryChunk;
- bool retval = chunk->load(filename);
+ bool retval = chunk->load(bin_file);
if (!retval) {
fprintf(stderr, "open %s failed!\n", bin_file);
exit(ENOENT);
}
phrase_index.load(i, chunk);
- g_free(filename);
}
/* Note: please increase the value when corpus size becomes larger.