summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-02-13 13:26:12 +0800
committerPeng Wu <alexepico@gmail.com>2012-02-13 14:01:20 +0800
commitad094960b7844a026e65c4d2aafb674783694a08 (patch)
treeaf2b3abd7055e66aeb5d0d8fea776373e3eb6395
parentdf0a8d47d1a2559628bee1729d840100962b72ac (diff)
downloadlibpinyin-ad094960b7844a026e65c4d2aafb674783694a08.zip
libpinyin-ad094960b7844a026e65c4d2aafb674783694a08.tar.gz
libpinyin-ad094960b7844a026e65c4d2aafb674783694a08.tar.xz
improves full pinyin parser
-rw-r--r--src/storage/pinyin_parser2.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp
index 80a525b..defc9fe 100644
--- a/src/storage/pinyin_parser2.cpp
+++ b/src/storage/pinyin_parser2.cpp
@@ -345,7 +345,9 @@ int FullPinyinParser2::parse (pinyin_option_t options, ChewingKeyVector & keys,
#endif
/* dynamic programming here. */
- for (size_t m = i; m < next_sep; ++m) {
+ /* for (size_t m = i; m < next_sep; ++m) */
+ {
+ size_t m = i;
curstep = &g_array_index(m_parse_steps, parse_value_t, m);
size_t try_len = std_lite::min
(m + max_full_pinyin_length, next_sep);
@@ -379,6 +381,7 @@ int FullPinyinParser2::parse (pinyin_option_t options, ChewingKeyVector & keys,
if (value.m_parsed_len == nextstep->m_parsed_len &&
value.m_num_keys < nextstep->m_num_keys)
*nextstep = value;
+
if (value.m_parsed_len == nextstep->m_parsed_len &&
value.m_num_keys == nextstep->m_num_keys) {