summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-12-24 11:07:04 +0800
committerPeng Wu <alexepico@gmail.com>2011-12-24 11:07:04 +0800
commit6d821d1b145c307a9bd71c2615b8e596774d1c82 (patch)
treef4f81c795c81c7bdc41c6166b080de8711c31349
parentcbd81a7b669bf97517ab9206ef12d29167a0fc41 (diff)
downloadlibpinyin-6d821d1b145c307a9bd71c2615b8e596774d1c82.tar.gz
libpinyin-6d821d1b145c307a9bd71c2615b8e596774d1c82.tar.xz
libpinyin-6d821d1b145c307a9bd71c2615b8e596774d1c82.zip
fixes post process in pinyin parser20.4.91
-rw-r--r--src/storage/pinyin_parser2.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp
index bab9d8a..45138da 100644
--- a/src/storage/pinyin_parser2.cpp
+++ b/src/storage/pinyin_parser2.cpp
@@ -440,23 +440,28 @@ bool FullPinyinParser2::post_process(pinyin_option_t options,
ChewingKey * cur_key = NULL, * next_key = NULL;
ChewingKeyRest * cur_rest = NULL, * next_rest = NULL;
- guint16 cur_tone = CHEWING_ZERO_TONE, next_tone = CHEWING_ZERO_TONE;
+ guint16 next_tone = CHEWING_ZERO_TONE;
for (i = 0; i < num_keys - 1; ++i) {
- cur_rest = &g_array_index(key_rests, ChewingKeyRest, i);
- next_rest = &g_array_index(key_rests, ChewingKeyRest, i + 1);
+ cur_key = &g_array_index(keys, ChewingKey, i);
+ next_key = &g_array_index(keys, ChewingKey, i + 1);
/* some "'" here */
- if (cur_rest->m_raw_end != next_rest->m_raw_begin)
+ if (0 == cur_key->get_table_index())
+ continue;
+ if (0 == next_key->get_table_index())
continue;
- cur_key = &g_array_index(keys, ChewingKey, i);
- next_key = &g_array_index(keys, ChewingKey, i + 1);
+ /* some tone here */
+ if (CHEWING_ZERO_TONE != cur_key->m_tone)
+ continue;
+
+ cur_rest = &g_array_index(key_rests, ChewingKeyRest, i);
+ next_rest = &g_array_index(key_rests, ChewingKeyRest, i + 1);
if (options & USE_TONE) {
- cur_tone = cur_key->m_tone;
next_tone = next_key->m_tone;
- cur_key->m_tone = next_key->m_tone = CHEWING_ZERO_TONE;
+ next_key->m_tone = CHEWING_ZERO_TONE;
}
/* lookup re-split table */
@@ -488,7 +493,6 @@ bool FullPinyinParser2::post_process(pinyin_option_t options,
/* save back tones */
if (options & USE_TONE) {
- cur_key->m_tone = cur_tone;
next_key->m_tone = next_tone;
}
}