summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/training/gen_k_mixture_model.cpp5
1 files changed, 5 insertions, 0 deletions
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. */