migrate export interpolation to use retrieve_all
authorPeng Wu <alexepico@gmail.com>
Wed, 18 Aug 2010 06:29:12 +0000 (14:29 +0800)
committerPeng Wu <alexepico@gmail.com>
Wed, 18 Aug 2010 06:29:12 +0000 (14:29 +0800)
utils/storage/export_interpolation.cpp

index 31dafb1..c0da280 100644 (file)
@@ -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);