From 0af289161d8498a0697132953b01b3ee2a340579 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Mon, 17 Jun 2013 16:16:11 +0800 Subject: fixes validate_bigram --- utils/training/validate_k_mixture_model.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'utils') 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); -- cgit