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 17:51:05 +0800
commitb7fade0d5b5b558973c0e9f400e87bd5ace381ea (patch)
treec3d019a6e11eeb28857cdb473b3f923e29b56b4b
parentedb82f8180ecfa5496821c6a4bfd275261bfa4bf (diff)
downloadlibpinyin-b7fade0d5b5b558973c0e9f400e87bd5ace381ea.tar.gz
libpinyin-b7fade0d5b5b558973c0e9f400e87bd5ace381ea.tar.xz
libpinyin-b7fade0d5b5b558973c0e9f400e87bd5ace381ea.zip
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)