summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-01-10 15:34:30 +0800
committerPeng Wu <alexepico@gmail.com>2012-01-10 15:34:30 +0800
commite10ff28e8c84869f1a474b1211d1650300a47b89 (patch)
treed4fac8f8676a1d222e2b3970c4d8fbcf1e57b6ae
parentd35ee490607c4d222ae81106c28dd8d008d2e1fe (diff)
downloadlibpinyin-e10ff28e8c84869f1a474b1211d1650300a47b89.zip
libpinyin-e10ff28e8c84869f1a474b1211d1650300a47b89.tar.gz
libpinyin-e10ff28e8c84869f1a474b1211d1650300a47b89.tar.xz
improves heuristic method
-rw-r--r--src/storage/pinyin_parser2.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp
index 483f4ed..ee43eaf 100644
--- a/src/storage/pinyin_parser2.cpp
+++ b/src/storage/pinyin_parser2.cpp
@@ -299,8 +299,10 @@ int FullPinyinParser2::parse (pinyin_option_t options, ChewingKeyVector & keys,
next_sep = k;
}
+ pinyin_option_t heuristic_options = options & ~PINYIN_CORRECT_ALL;
+
/* Heuristic Method:
- * do maximum forward match first. */
+ * do maximum forward match first, and without auto corrections. */
for (size_t pos = i; pos < next_sep; ++pos) {
curstep = &g_array_index(m_parse_steps, parse_value_t, pos);
size_t try_len = std_lite::min
@@ -315,7 +317,7 @@ int FullPinyinParser2::parse (pinyin_option_t options, ChewingKeyVector & keys,
ChewingKey key; ChewingKeyRest rest;
bool parsed = parse_one_key
- (options, key, onepinyin, onepinyinlen);
+ (heuristic_options, key, onepinyin, onepinyinlen);
rest.m_raw_begin = pos; rest.m_raw_end = n;
if (!parsed)