[libpinyin] Fixes incomplete pinyin
Peng Wu
pwu at fedoraproject.org
Mon Jan 28 06:05:06 UTC 2013
commit d32742eef00d471e5cf934144d65df7f15896b1d
Author: Peng Wu <alexepico at gmail.com>
Date: Mon Jan 28 13:43:58 2013 +0800
Fixes incomplete pinyin
libpinyin-0.8.x-head.patch | 57 ++++++++++++++++++++++++++++++++++++++++++-
libpinyin.spec | 13 ++++++++-
2 files changed, 66 insertions(+), 4 deletions(-)
---
diff --git a/libpinyin-0.8.x-head.patch b/libpinyin-0.8.x-head.patch
index d5eb9f8..12cde47 100644
--- a/libpinyin-0.8.x-head.patch
+++ b/libpinyin-0.8.x-head.patch
@@ -1,7 +1,7 @@
From f21bba5df05c174ff91bb89d86b0d383767f99dd Mon Sep 17 00:00:00 2001
From: Peng Wu <alexepico at gmail.com>
Date: Tue, 11 Dec 2012 14:15:49 +0800
-Subject: [PATCH] a safe guard for chewing
+Subject: [PATCH 1/2] a safe guard for chewing
---
src/storage/phrase_index.h | 15 +++++++--------
@@ -36,5 +36,58 @@ index acc7c4a..bc6aad2 100644
}
--
-1.7.11.7
+1.8.1
+
+
+From 095fbb86d0063dd22230c6aff879fd6eca745d2d Mon Sep 17 00:00:00 2001
+From: Peng Wu <alexepico at gmail.com>
+Date: Fri, 25 Jan 2013 12:16:19 +0800
+Subject: [PATCH 2/2] fixes incomplete pinyin
+
+---
+ src/storage/pinyin_phrase2.h | 22 ++++++++++++++++++----
+ 1 file changed, 18 insertions(+), 4 deletions(-)
+
+diff --git a/src/storage/pinyin_phrase2.h b/src/storage/pinyin_phrase2.h
+index ba658f0..d5042aa 100644
+--- a/src/storage/pinyin_phrase2.h
++++ b/src/storage/pinyin_phrase2.h
+@@ -132,6 +132,10 @@ inline void compute_lower_value2(pinyin_option_t options,
+ * to check lower bound.
+ */
+
++ /* as chewing zero middle is the first item, and its value is zero,
++ * no need to adjust it for incomplete pinyin.
++ */
++
+ /* compute lower final */
+ sel = aKey.m_final;
+ for (k = aKey.m_final - 1; k >= CHEWING_ZERO_FINAL; --k) {
+@@ -183,10 +187,20 @@ inline void compute_upper_value2(pinyin_option_t options,
+ }
+ aKey.m_initial = (ChewingInitial)sel;
+
+- /* compute upper middle, skipped as no fuzzy pinyin here.
+- * if needed in future, still use pinyin_compare_middle_and_final2
+- * to check upper bound.
+- */
++ /* adjust it for incomplete pinyin. */
++
++ /* compute upper middle */
++ sel = aKey.m_middle;
++ for (k = aKey.m_middle + 1; k <= CHEWING_LAST_MIDDLE; ++k) {
++ if (0 != pinyin_compare_middle_and_final2
++ (options,
++ (ChewingMiddle)aKey.m_middle, (ChewingMiddle)k,
++ (ChewingFinal)aKey.m_final, (ChewingFinal)aKey.m_final))
++ break;
++ else
++ sel = k;
++ }
++ aKey.m_middle = (ChewingMiddle)sel;
+
+ /* compute upper final */
+ sel = aKey.m_final;
+--
+1.8.1
diff --git a/libpinyin.spec b/libpinyin.spec
index 6ac3d7b..0a75570 100644
--- a/libpinyin.spec
+++ b/libpinyin.spec
@@ -1,12 +1,16 @@
+%global snapshot 1
+
Name: libpinyin
Version: 0.8.0
-Release: 2%{?dist}
+Release: 3%{?dist}
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
+%if %snapshot
Patch0: libpinyin-0.8.x-head.patch
+%endif
BuildRequires: libdb-devel, glib2-devel
Requires: %{name}-data = %{version}-%{release}
@@ -43,8 +47,10 @@ The %{name}-tools package contains tools.
%prep
%setup -q
-%patch0 -p1 -b .head
+%if %snapshot
+%patch0 -p1 -b .head
+%endif
%build
%configure --disable-static
@@ -86,6 +92,9 @@ find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
%{_mandir}/man1/*.1.*
%changelog
+* Mon Jan 28 2013 Peng Wu <pwu at redhat.com> - 0.8.0-3
+- Fixes incomplete pinyin
+
* Wed Dec 12 2012 Peng Wu <pwu at redhat.com> - 0.8.0-2
- Fixes chewing input
More information about the scm-commits
mailing list