summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2015-04-21 15:04:27 +0800
committerPeng Wu <alexepico@gmail.com>2015-04-21 15:04:27 +0800
commit8fc2fc4da82250bfe33c81c3575cb4d5fdde10dc (patch)
tree1870d5999275367a932d2b2a2e9ed8aec4c08d12 /utils
parent107f642630eed151e859583d493ee677b5b063b9 (diff)
downloadlibpinyin-8fc2fc4da82250bfe33c81c3575cb4d5fdde10dc.zip
libpinyin-8fc2fc4da82250bfe33c81c3575cb4d5fdde10dc.tar.gz
libpinyin-8fc2fc4da82250bfe33c81c3575cb4d5fdde10dc.tar.xz
fixes bugs
Diffstat (limited to 'utils')
-rw-r--r--utils/training/estimate_k_mixture_model.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/utils/training/estimate_k_mixture_model.cpp b/utils/training/estimate_k_mixture_model.cpp
index c0fa03f..c95cde2 100644
--- a/utils/training/estimate_k_mixture_model.cpp
+++ b/utils/training/estimate_k_mixture_model.cpp
@@ -109,10 +109,7 @@ int main(int argc, char * argv[]){
exit(EINVAL);
}
- /* TODO: magic header signature check here. */
- KMixtureModelBigram unigram(K_MIXTURE_MODEL_MAGIC_NUMBER);
- unigram.attach(bigram_filename, ATTACH_READONLY);
-
+ /* magic header signature check here. */
KMixtureModelBigram bigram(K_MIXTURE_MODEL_MAGIC_NUMBER);
bigram.attach(bigram_filename, ATTACH_READONLY);
@@ -128,7 +125,7 @@ int main(int argc, char * argv[]){
for( size_t i = 0; i < deleted_items->len; ++i ){
phrase_token_t * token = &g_array_index(deleted_items, phrase_token_t, i);
KMixtureModelSingleGram * single_gram = NULL;
- bigram.load(*token, single_gram);
+ bigram.load(*token, single_gram, true);
KMixtureModelSingleGram * deleted_single_gram = NULL;
deleted_bigram.load(*token, deleted_single_gram);
@@ -140,7 +137,7 @@ int main(int argc, char * argv[]){
assert(deleted_single_gram->get_array_header(deleted_array_header));
if ( 0 != deleted_array_header.m_WC ) {
- parameter_t lambda = compute_interpolation(deleted_single_gram, &unigram, single_gram);
+ parameter_t lambda = compute_interpolation(deleted_single_gram, &bigram, single_gram);
printf("token:%d lambda:%f\n", *token, lambda);