diff options
author | Peng Wu <alexepico@gmail.com> | 2010-08-18 14:58:57 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2010-08-18 14:58:57 +0800 |
commit | 6f3ee371d7118ac04327a7654a519657e8981edd (patch) | |
tree | b1de5338007b83f3babf9805831ff3f0aff56724 /utils/storage/export_interpolation.cpp | |
parent | 6f8c022c759f7930449596bdad0bcc9b23cdcb41 (diff) | |
download | libpinyin-6f3ee371d7118ac04327a7654a519657e8981edd.tar.gz libpinyin-6f3ee371d7118ac04327a7654a519657e8981edd.tar.xz libpinyin-6f3ee371d7118ac04327a7654a519657e8981edd.zip |
add get_range to phrase index
Diffstat (limited to 'utils/storage/export_interpolation.cpp')
-rw-r--r-- | utils/storage/export_interpolation.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
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); |