summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-06-17 16:16:11 +0800
committerPeng Wu <alexepico@gmail.com>2013-06-17 16:16:11 +0800
commit0af289161d8498a0697132953b01b3ee2a340579 (patch)
treef4d1e461bf56559f8a7c5eb4c92490bfb280a44f /utils
parenta6879516feb3e906ba1d0ed7847300bcfee7e092 (diff)
downloadlibpinyin-0af289161d8498a0697132953b01b3ee2a340579.tar.gz
libpinyin-0af289161d8498a0697132953b01b3ee2a340579.tar.xz
libpinyin-0af289161d8498a0697132953b01b3ee2a340579.zip
fixes validate_bigram
Diffstat (limited to 'utils')
-rw-r--r--utils/training/validate_k_mixture_model.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/utils/training/validate_k_mixture_model.cpp b/utils/training/validate_k_mixture_model.cpp
index c51bbc5..7c057b9 100644
--- a/utils/training/validate_k_mixture_model.cpp
+++ b/utils/training/validate_k_mixture_model.cpp
@@ -90,6 +90,7 @@ bool validate_bigram(KMixtureModelBigram * bigram){
phrase_token_t * token = &g_array_index(items, phrase_token_t, i);
KMixtureModelSingleGram * single_gram = NULL;
assert(bigram->load(*token, single_gram));
+
FlexibleBigramPhraseArray array = g_array_new
(FALSE, FALSE, sizeof(KMixtureModelArrayItemWithToken));
single_gram->retrieve_all(array);
@@ -106,6 +107,7 @@ bool validate_bigram(KMixtureModelBigram * bigram){
result = false;
}
if ( 0 != freq ){
+ delete single_gram;
continue;
} else {
fprintf(stderr, "in the array header of token %d:\n", *token);
@@ -130,6 +132,7 @@ bool validate_bigram(KMixtureModelBigram * bigram){
}
g_array_free(array, TRUE);
+ delete single_gram;
}
g_array_free(items, TRUE);