diff options
author | Peng Wu <alexepico@gmail.com> | 2010-08-18 14:29:12 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2010-08-18 14:29:12 +0800 |
commit | eb08017561445d566b8c6c8558be18ff84038b42 (patch) | |
tree | 1333061051d282262b4a78788ad10cb57466acbe /utils | |
parent | ce8b4cf9be402e42cc8f8abd55daef2aee7e7cf6 (diff) | |
download | libpinyin-eb08017561445d566b8c6c8558be18ff84038b42.tar.gz libpinyin-eb08017561445d566b8c6c8558be18ff84038b42.tar.xz libpinyin-eb08017561445d566b8c6c8558be18ff84038b42.zip |
migrate export interpolation to use retrieve_all
Diffstat (limited to 'utils')
-rw-r--r-- | utils/storage/export_interpolation.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/utils/storage/export_interpolation.cpp b/utils/storage/export_interpolation.cpp index 31dafb1..c0da280 100644 --- a/utils/storage/export_interpolation.cpp +++ b/utils/storage/export_interpolation.cpp @@ -101,15 +101,14 @@ void gen_bigram(FILE * output, FacadePhraseIndex * phrase_index, Bigram * bigram range.m_range_begin = token_min; range.m_range_end = token_max; - BigramPhraseArray array = g_array_new(FALSE, FALSE, sizeof(BigramPhraseItem)); - system->search(&range, array); + BigramPhraseWithCountArray array = g_array_new(FALSE, FALSE, sizeof(BigramPhraseItemWithCount)); + system->retrieve_all(array); for(int j = 0; j < array->len; j++) { - BigramPhraseItem * item = &g_array_index(array, BigramPhraseItem, j); + BigramPhraseItemWithCount * item = &g_array_index(array, BigramPhraseItemWithCount, j); char * word1 = token_to_string(phrase_index, token); char * word2 = token_to_string(phrase_index, item->m_token); - guint32 freq = 0; - assert(system->get_freq(item->m_token, freq)); + guint32 freq = item->m_count; if ( word1 && word2) fprintf(output, "\\item %s %s count %d\n", word1, word2, freq); |