summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-05-24 11:20:51 +0800
committerPeng Wu <alexepico@gmail.com>2011-05-24 11:20:51 +0800
commit1bb50d2455d69047cccc53f0daf0debac73ec403 (patch)
tree759defe371560b1164ff7f85153a3030e372edb3 /utils
parentaa84722e1a97cba481d717284ca8160bd5e1d2ac (diff)
downloadlibpinyin-1bb50d2455d69047cccc53f0daf0debac73ec403.tar.gz
libpinyin-1bb50d2455d69047cccc53f0daf0debac73ec403.tar.xz
libpinyin-1bb50d2455d69047cccc53f0daf0debac73ec403.zip
fixes m_N in magic header of gen k mixture model
Diffstat (limited to 'utils')
-rw-r--r--utils/training/gen_k_mixture_model.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/utils/training/gen_k_mixture_model.cpp b/utils/training/gen_k_mixture_model.cpp
index 0d7204f..fd48f51 100644
--- a/utils/training/gen_k_mixture_model.cpp
+++ b/utils/training/gen_k_mixture_model.cpp
@@ -216,7 +216,6 @@ static bool train_second_word(HashofDocument hash_of_document,
return false;
}
magic_header.m_WC += delta;
- magic_header.m_N ++;
assert(bigram->set_magic_header(magic_header));
/* save the single gram. */
@@ -294,6 +293,11 @@ int main(int argc, char * argv[]){
train_second_word(hash_of_document, &bigram, token);
}
+ KMixtureModelMagicHeader magic_header;
+ assert(bigram.get_magic_header(magic_header));
+ magic_header.m_N ++;
+ assert(bigram.set_magic_header(magic_header));
+
/* free resources of g_hash_of_document */
g_hash_table_iter_init(&iter, hash_of_document);
while (g_hash_table_iter_next(&iter, &key, &value)) {