summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-01-16 16:40:12 +0800
committerPeng Wu <alexepico@gmail.com>2012-01-16 17:01:57 +0800
commit7bfcb3735dd0cb7526e25e24a37adca815cad6b5 (patch)
tree12b4bd55bb0a07688349d334aa701ef57eeb3360
parente30c37cceed1032b9f6fe84a34cf9f45034782f6 (diff)
downloadlibpinyin-7bfcb3735dd0cb7526e25e24a37adca815cad6b5.zip
libpinyin-7bfcb3735dd0cb7526e25e24a37adca815cad6b5.tar.gz
libpinyin-7bfcb3735dd0cb7526e25e24a37adca815cad6b5.tar.xz
fixes full pinyin parser2
-rw-r--r--src/storage/pinyin_parser2.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp
index 081b069..deef306 100644
--- a/src/storage/pinyin_parser2.cpp
+++ b/src/storage/pinyin_parser2.cpp
@@ -380,10 +380,24 @@ int FullPinyinParser2::parse (pinyin_option_t options, ChewingKeyVector & keys,
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 &&
- value.m_key.m_initial != CHEWING_ZERO_INITIAL &&
- nextstep->m_key.m_initial == CHEWING_ZERO_INITIAL)
- *nextstep = value;
+ value.m_num_keys == nextstep->m_num_keys) {
+
+ /* "kaneiji" -> "ka'nei'ji" */
+ if ((value.m_key.m_initial != CHEWING_ZERO_INITIAL &&
+ !(value.m_key.m_middle == CHEWING_ZERO_MIDDLE &&
+ value.m_key.m_final == CHEWING_ZERO_FINAL)) &&
+ nextstep->m_key.m_initial == CHEWING_ZERO_INITIAL)
+ *nextstep = value;
+
+ /* "xierqi" -> "xi'er'qi." */
+ if ((value.m_key.m_initial == CHEWING_ZERO_INITIAL &&
+ value.m_key.m_middle == CHEWING_ZERO_MIDDLE &&
+ value.m_key.m_final == CHEWING_ER) &&
+ (nextstep->m_key.m_initial == CHEWING_R &&
+ nextstep->m_key.m_middle == CHEWING_ZERO_MIDDLE &&
+ nextstep->m_key.m_final == CHEWING_ZERO_FINAL))
+ *nextstep = value;
+ }
}
}
}