[libpinyin] Fixes chewing input

Peng Wu pwu at fedoraproject.org
Wed Dec 12 05:37:13 UTC 2012


commit 29ada9f4338a82561aeb5f59c29f1963face1bc9
Author: Peng Wu <alexepico at gmail.com>
Date:   Wed Dec 12 13:33:38 2012 +0800

    Fixes chewing input

 libpinyin-0.8.x-head.patch |   40 ++++++++++++++++++++++++++++++++++++++++
 libpinyin.spec             |    5 ++++-
 2 files changed, 44 insertions(+), 1 deletions(-)
---
diff --git a/libpinyin-0.8.x-head.patch b/libpinyin-0.8.x-head.patch
index e69de29..d5eb9f8 100644
--- a/libpinyin-0.8.x-head.patch
+++ b/libpinyin-0.8.x-head.patch
@@ -0,0 +1,40 @@
+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
+
+---
+ src/storage/phrase_index.h | 15 +++++++--------
+ 1 file changed, 7 insertions(+), 8 deletions(-)
+
+diff --git a/src/storage/phrase_index.h b/src/storage/phrase_index.h
+index acc7c4a..bc6aad2 100644
+--- a/src/storage/phrase_index.h
++++ b/src/storage/phrase_index.h
+@@ -147,16 +147,15 @@ public:
+ 		matched += *freq;
+ 	    }
+ 	}
+-	// use preprocessor to avoid zero freq, in gen_pinyin_table.
+-	/*
++
++#if 1
++        /* an additional safe guard for chewing. */
+ 	if ( 0 == total_freq )
+-	    return 0.1;
+-	*/
++	    return 0;
++#endif
++
++	/* used preprocessor to avoid zero freq, in gen_chewing_table. */
+ 	gfloat retval = matched / (gfloat) total_freq;
+-	/*
+-	if ( 0 == retval )
+-	    return 0.03;
+-	*/
+ 	return retval;
+     }
+ 
+-- 
+1.7.11.7
+
diff --git a/libpinyin.spec b/libpinyin.spec
index 2326c7e..6ac3d7b 100644
--- a/libpinyin.spec
+++ b/libpinyin.spec
@@ -1,6 +1,6 @@
 Name:           libpinyin
 Version:        0.8.0
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Library to deal with pinyin
 
 License:        GPLv2+
@@ -86,6 +86,9 @@ find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
 %{_mandir}/man1/*.1.*
 
 %changelog
+* Wed Dec 12 2012 Peng Wu <pwu at redhat.com> - 0.8.0-2
+- Fixes chewing input
+
 * Wed Nov 14 2012  Peng Wu <pwu at redhat.com> - 0.8.0-1
 - Update to 0.8.0
 


More information about the scm-commits mailing list