populate_candidates(candidates, step);
get_top_results(topresults, candidates);
+ if (0 == topresults->len)
+ continue;
+
for ( int m = i + 1; m < nstep; ++m ){
const int len = m - i;
if (len > MAX_PHRASE_LENGTH)
int result = m_pinyin_table->search(len, pinyin_keys + i, ranges);
if (result & SEARCH_OK) {
+ /* assume topresults always contains items. */
search_bigram2(topresults, i, ranges),
search_unigram2(topresults, i, ranges);
}
bool PinyinLookup2::search_unigram2(GPtrArray * topresults, int nstep,
PhraseIndexRanges ranges) {
- if (0 == topresults->len)
- return false;
lookup_value_t * max = (lookup_value_t *)
g_ptr_array_index(topresults, 0);
bool PinyinLookup2::search_bigram2(GPtrArray * topresults, int nstep,
PhraseIndexRanges ranges) {
- if (0 == topresults->len)
- return false;
- lookup_constraint_t* constraint =
+ lookup_constraint_t * constraint =
&g_array_index(m_constraints, lookup_constraint_t, nstep);
bool found = false;