From fdcd60b8c885296f6854eb27b117ce2b5a176e10 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Mon, 30 May 2011 17:37:53 +0800 Subject: fixes gen k mixture model --- utils/training/gen_k_mixture_model.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'utils') diff --git a/utils/training/gen_k_mixture_model.cpp b/utils/training/gen_k_mixture_model.cpp index d237634..f6e94b4 100644 --- a/utils/training/gen_k_mixture_model.cpp +++ b/utils/training/gen_k_mixture_model.cpp @@ -203,6 +203,11 @@ static bool train_second_word(KMixtureModelBigram * bigram, single_gram = new KMixtureModelSingleGram; train_single_gram(hash_of_document, single_gram, token1, delta); + if ( 0 == delta ){ + delete single_gram; + return false; + } + KMixtureModelMagicHeader magic_header; if (!bigram->get_magic_header(magic_header)){ /* the first time to access the new k mixture model file. */ -- cgit