fixes full pinyin parser

This commit is contained in:
Peng Wu 2012-01-29 13:22:00 +08:00
parent 00273806b6
commit 8db947f122

View File

@ -1,7 +1,7 @@
From b54a7e1600ba00d9886a0d17b0f923e40cf9672c Mon Sep 17 00:00:00 2001
From: Peng Wu <alexepico@gmail.com>
Date: Sun, 29 Jan 2012 10:26:17 +0800
Subject: [PATCH 1/2] fixes pinyin parsers
Subject: [PATCH 1/3] fixes pinyin parsers
---
src/storage/pinyin_parser2.cpp | 4 +++-
@ -43,7 +43,7 @@ index deef306..4ab36aa 100644
From 06668708392d044b0656b5f8e7569c71c169fb16 Mon Sep 17 00:00:00 2001
From: Peng Wu <alexepico@gmail.com>
Date: Sun, 29 Jan 2012 11:06:48 +0800
Subject: [PATCH 2/2] fixes parse one key
Subject: [PATCH 2/3] fixes parse one key
---
src/storage/pinyin_parser2.cpp | 6 ++++++
@ -76,3 +76,49 @@ index 4ab36aa..0437440 100644
--
1.7.7.5
From 741f495134ac477631126358f204034507f1d5f3 Mon Sep 17 00:00:00 2001
From: Peng Wu <alexepico@gmail.com>
Date: Sun, 29 Jan 2012 13:17:33 +0800
Subject: [PATCH 3/3] fixes post process in full pinyin parser
---
src/storage/pinyin_parser2.cpp | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp
index 0437440..ab8330c 100644
--- a/src/storage/pinyin_parser2.cpp
+++ b/src/storage/pinyin_parser2.cpp
@@ -464,22 +464,20 @@ bool FullPinyinParser2::post_process(pinyin_option_t options,
guint16 next_tone = CHEWING_ZERO_TONE;
for (i = 0; i < num_keys - 1; ++i) {
- cur_key = &g_array_index(keys, ChewingKey, i);
- next_key = &g_array_index(keys, ChewingKey, i + 1);
+ cur_rest = &g_array_index(key_rests, ChewingKeyRest, i);
+ next_rest = &g_array_index(key_rests, ChewingKeyRest, i + 1);
/* some "'" here */
- if (0 == cur_key->get_table_index())
- continue;
- if (0 == next_key->get_table_index())
+ if (cur_rest->m_raw_end != next_rest->m_raw_begin)
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) {
next_tone = next_key->m_tone;
next_key->m_tone = CHEWING_ZERO_TONE;
--
1.7.7.5