update patches

This commit is contained in:
Peng Wu 2012-02-13 11:25:51 +08:00
parent 006b8e9081
commit 944e222f32
3 changed files with 1 additions and 125 deletions

View File

@ -1,124 +0,0 @@
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/3] fixes pinyin parsers
---
src/storage/pinyin_parser2.cpp | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp
index deef306..4ab36aa 100644
--- a/src/storage/pinyin_parser2.cpp
+++ b/src/storage/pinyin_parser2.cpp
@@ -526,6 +526,7 @@ bool FullPinyinParser2::post_process(pinyin_option_t options,
bool DoublePinyinParser2::parse_one_key(pinyin_option_t options,
ChewingKey & key,
const char *str, int len) const {
+ options &= ~(PINYIN_CORRECT_ALL|PINYIN_AMB_ALL);
if (1 == len) {
if (!(options & PINYIN_INCOMPLETE))
@@ -548,7 +549,7 @@ bool DoublePinyinParser2::parse_one_key(pinyin_option_t options,
}
ChewingTone tone = CHEWING_ZERO_TONE;
- options &= ~(PINYIN_CORRECT_ALL|PINYIN_AMB_ALL);
+ options &= ~(PINYIN_INCOMPLETE|CHEWING_INCOMPLETE);
/* parse tone */
if (3 == len) {
@@ -718,6 +719,7 @@ static bool search_chewing_tones(const chewing_tone_item_t * tone_table,
bool ChewingParser2::parse_one_key(pinyin_option_t options,
ChewingKey & key,
const char *str, int len) const {
+ options &= ~(PINYIN_CORRECT_ALL|PINYIN_AMB_ALL);
char tone = CHEWING_ZERO_TONE;
int symbols_len = len;
--
1.7.7.5
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/3] fixes parse one key
---
src/storage/pinyin_parser2.cpp | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp
index 4ab36aa..0437440 100644
--- a/src/storage/pinyin_parser2.cpp
+++ b/src/storage/pinyin_parser2.cpp
@@ -582,6 +582,9 @@ bool DoublePinyinParser2::parse_one_key(pinyin_option_t options,
charid = ch == ';' ? 26 : ch - 'a';
/* first yunmu */
const char * yun = m_yunmu_table[charid].m_yunmus[0];
+ if (NULL == yun)
+ return false;
+
gchar * pinyin = g_strdup_printf("%s%s", sheng, yun);
if (search_pinyin_index(options, pinyin, key)) {
key.m_tone = tone;
@@ -592,6 +595,9 @@ bool DoublePinyinParser2::parse_one_key(pinyin_option_t options,
/* second yunmu */
yun = m_yunmu_table[charid].m_yunmus[1];
+ if (NULL == yun)
+ return false;
+
pinyin = g_strdup_printf("%s%s", sheng, yun);
if (search_pinyin_index(options, pinyin, key)) {
key.m_tone = tone;
--
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

View File

View File

@ -6,7 +6,7 @@ Summary: Library to deal with pinyin
License: GPLv2+
URL: https://github.com/libpinyin/libpinyin
Source0: https://github.com/downloads/libpinyin/libpinyin/%{name}-%{version}.tar.gz
Patch0: libpinyin-0.5.x-head.patch
Patch0: libpinyin-0.6.x-head.patch
BuildRequires: db4-devel, glib2-devel
Requires: %{name}-data = %{version}-%{release}