summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lookup/phrase_lookup.cpp2
-rw-r--r--src/lookup/pinyin_lookup2.cpp2
2 files changed, 4 insertions, 0 deletions
diff --git a/src/lookup/phrase_lookup.cpp b/src/lookup/phrase_lookup.cpp
index b22ef84..6e661ec 100644
--- a/src/lookup/phrase_lookup.cpp
+++ b/src/lookup/phrase_lookup.cpp
@@ -136,6 +136,8 @@ bool PhraseLookup::get_best_match(int sentence_length, ucs4_t sentence[],
for ( int i = 0; i < nstep - 1; ++i ){
for ( int m = i + 1; m < nstep; ++m ){
+ m_phrase_index->clear_tokens(tokens);
+
/* do one phrase table search. */
int result = m_phrase_table->search(m - i, sentence + i, tokens);
diff --git a/src/lookup/pinyin_lookup2.cpp b/src/lookup/pinyin_lookup2.cpp
index 9d5ad67..74a60ff 100644
--- a/src/lookup/pinyin_lookup2.cpp
+++ b/src/lookup/pinyin_lookup2.cpp
@@ -264,6 +264,8 @@ bool PinyinLookup2::get_best_match(TokenVector prefixes,
if (CONSTRAINT_NOSEARCH == next_constraint->m_type)
break;
+ m_phrase_index->clear_ranges(ranges);
+
ChewingKey * pinyin_keys = (ChewingKey *)m_keys->data;
/* do one pinyin table search. */
int result = m_pinyin_table->search(len, pinyin_keys + i, ranges);