From 6f3ee371d7118ac04327a7654a519657e8981edd Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Wed, 18 Aug 2010 14:58:57 +0800 Subject: add get_range to phrase index --- utils/storage/export_interpolation.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'utils/storage') diff --git a/utils/storage/export_interpolation.cpp b/utils/storage/export_interpolation.cpp index e91fd74..43a2c61 100644 --- a/utils/storage/export_interpolation.cpp +++ b/utils/storage/export_interpolation.cpp @@ -53,16 +53,16 @@ int main(int argc, char * argv[]){ void gen_unigram(FILE * output, FacadePhraseIndex * phrase_index) { fprintf(output, "\\1-gram\n"); for ( size_t i = 0; i < PHRASE_INDEX_LIBRARY_COUNT; i++) { - /* Generate each phrase index library */ - const phrase_token_t min = PHRASE_INDEX_MAKE_TOKEN(i, token_min); - const phrase_token_t max = PHRASE_INDEX_MAKE_TOKEN(i, token_max); + + PhraseIndexRange range; + int result = phrase_index->get_range(i, range); + if ( result ) + continue; PhraseItem item; - for ( size_t j = min; j < max; j++) { + for ( size_t j = range.m_range_begin; j < range.m_range_end; j++) { int result = phrase_index->get_phrase_item(j, item); - if ( result == ERROR_NO_SUB_PHRASE_INDEX || - result == ERROR_OUT_OF_RANGE) - break; + if ( result == ERROR_NO_ITEM ) continue; assert( result == ERROR_OK); -- cgit