diff options
author | Peng Wu <alexepico@gmail.com> | 2011-06-09 10:24:29 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2011-06-09 10:24:29 +0800 |
commit | bcf6608ccc250942f670617b19d71b033677e347 (patch) | |
tree | 67979ec97ae0b3cf16e490f758811b4f1400db31 /utils | |
parent | e5e61366f18eb7d3a2f9671768e4480704f3b62f (diff) | |
download | libpinyin-bcf6608ccc250942f670617b19d71b033677e347.tar.gz libpinyin-bcf6608ccc250942f670617b19d71b033677e347.tar.xz libpinyin-bcf6608ccc250942f670617b19d71b033677e347.zip |
improves estimate k mixture model
Diffstat (limited to 'utils')
-rw-r--r-- | utils/training/estimate_k_mixture_model.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/utils/training/estimate_k_mixture_model.cpp b/utils/training/estimate_k_mixture_model.cpp index ee9be61..36d5a1b 100644 --- a/utils/training/estimate_k_mixture_model.cpp +++ b/utils/training/estimate_k_mixture_model.cpp @@ -37,6 +37,7 @@ parameter_t compute_interpolation(KMixtureModelSingleGram * deleted_bigram, KMixtureModelMagicHeader magic_header; assert(unigram->get_magic_header(magic_header)); + assert(0 != magic_header.m_total_freq); while (fabs(lambda - next_lambda) > epsilon){ lambda = next_lambda; @@ -69,9 +70,7 @@ parameter_t compute_interpolation(KMixtureModelSingleGram * deleted_bigram, parameter_t elem_poss = 0; KMixtureModelArrayHeader array_header; if (unigram->get_array_header(token, array_header)){ - /* Note: optimize here? */ - assert(0 != magic_header.m_WC); - elem_poss = array_header.m_WC / (parameter_t) magic_header.m_WC; + elem_poss = array_header.m_freq / (parameter_t) magic_header.m_total_freq; } part_of_denominator = (1 - lambda) * elem_poss; } |