summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-06-20 16:03:46 +0800
committerPeng Wu <alexepico@gmail.com>2016-06-20 16:03:46 +0800
commit1ac3ccf02bf12678057ac0c6d89d4d3d41e5bdba (patch)
tree2e9948633b6dafe947ebfaa681b0c56334a4b970
parent8861bc3da5e49f0c0ae074593a72df3771d57ec6 (diff)
downloadlibpinyin-1ac3ccf02bf12678057ac0c6d89d4d3d41e5bdba.tar.gz
libpinyin-1ac3ccf02bf12678057ac0c6d89d4d3d41e5bdba.tar.xz
libpinyin-1ac3ccf02bf12678057ac0c6d89d4d3d41e5bdba.zip
fixes bugs
-rw-r--r--src/pinyin.cpp4
-rw-r--r--utils/segment/spseg.cpp1
2 files changed, 4 insertions, 1 deletions
diff --git a/src/pinyin.cpp b/src/pinyin.cpp
index b107918..b2865ef 100644
--- a/src/pinyin.cpp
+++ b/src/pinyin.cpp
@@ -1717,8 +1717,10 @@ bool pinyin_guess_candidates(pinyin_instance_t * instance,
retval = search_matrix(context->m_addon_pinyin_table, &matrix,
start, end, addon_ranges) | retval;
- if ( !(retval & SEARCH_OK) )
+ if ( !(retval & SEARCH_OK) ) {
+ ++end;
continue;
+ }
lookup_candidate_t template_item;
template_item.m_begin = start; template_item.m_end = end;
diff --git a/utils/segment/spseg.cpp b/utils/segment/spseg.cpp
index b434e4a..5934270 100644
--- a/utils/segment/spseg.cpp
+++ b/utils/segment/spseg.cpp
@@ -106,6 +106,7 @@ bool segment(FacadePhraseTable3 * phrase_table,
ucs4_t * cur_phrase = phrase + i;
phrase_token_t token = null_token;
+ phrase_index->clear_tokens(tokens);
int result = phrase_table->search(len, cur_phrase, tokens);
int num = get_first_token(tokens, token);