diff options
author | Peng Wu <alexepico@gmail.com> | 2010-08-18 14:33:52 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2010-08-18 14:33:52 +0800 |
commit | 307aeb8feca322c0de144623c37edb4d7a21a66f (patch) | |
tree | 940a2ceabd6053153faa9eb0a382408a57c869b6 | |
parent | eb08017561445d566b8c6c8558be18ff84038b42 (diff) | |
download | libpinyin-307aeb8feca322c0de144623c37edb4d7a21a66f.tar.gz libpinyin-307aeb8feca322c0de144623c37edb4d7a21a66f.tar.xz libpinyin-307aeb8feca322c0de144623c37edb4d7a21a66f.zip |
migrate estimate interpolation to retrieve_all
-rw-r--r-- | src/training/estimate_interpolation.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/training/estimate_interpolation.cpp b/src/training/estimate_interpolation.cpp index afe369e..aaae17b 100644 --- a/src/training/estimate_interpolation.cpp +++ b/src/training/estimate_interpolation.cpp @@ -44,19 +44,15 @@ parameter_t compute_interpolation(SingleGram * deleted_bigram, parameter_t numerator = 0; parameter_t part_of_denominator = 0; - PhraseIndexRange range; - range.m_range_begin = token_min; - range.m_range_end = token_max; - - BigramPhraseArray array = g_array_new(FALSE, FALSE, sizeof(BigramPhraseItem)); - deleted_bigram->search(&range, array); + BigramPhraseWithCountArray array = g_array_new(FALSE, FALSE, sizeof(BigramPhraseItemWithCount)); + deleted_bigram->retrieve_all(array); for ( int i = 0; i < array->len; ++i){ - BigramPhraseItem * item = &g_array_index(array, BigramPhraseItem, i); + BigramPhraseItemWithCount* item = &g_array_index(array, BigramPhraseItemWithCount, i); //get the phrase token phrase_token_t token = item->m_token; - guint32 deleted_freq = 0; - assert(deleted_bigram->get_freq(token, deleted_freq)); + guint32 deleted_freq = item->m_count; + { guint32 freq = 0; parameter_t elem_poss = 0; |