summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-05-30 17:37:53 +0800
committerPeng Wu <alexepico@gmail.com>2011-05-30 17:37:53 +0800
commitfdcd60b8c885296f6854eb27b117ce2b5a176e10 (patch)
tree2e17c3e5e66b028456decc951a61b7f3d710279b /utils
parente68ab087a01c8f4cf1b5d509cfc0658ea7cf4ab3 (diff)
downloadlibpinyin-fdcd60b8c885296f6854eb27b117ce2b5a176e10.tar.gz
libpinyin-fdcd60b8c885296f6854eb27b117ce2b5a176e10.tar.xz
libpinyin-fdcd60b8c885296f6854eb27b117ce2b5a176e10.zip
fixes gen k mixture model
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. */