improves full pinyin parser2

This commit is contained in:
Peng Wu 2012-02-14 10:32:37 +08:00
parent 944e222f32
commit b011cca277
2 changed files with 39 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From ad094960b7844a026e65c4d2aafb674783694a08 Mon Sep 17 00:00:00 2001
From: Peng Wu <alexepico@gmail.com>
Date: Mon, 13 Feb 2012 13:26:12 +0800
Subject: [PATCH] improves full pinyin parser
---
src/storage/pinyin_parser2.cpp | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp
index 80a525b..defc9fe 100644
--- a/src/storage/pinyin_parser2.cpp
+++ b/src/storage/pinyin_parser2.cpp
@@ -345,7 +345,9 @@ int FullPinyinParser2::parse (pinyin_option_t options, ChewingKeyVector & keys,
#endif
/* dynamic programming here. */
- for (size_t m = i; m < next_sep; ++m) {
+ /* for (size_t m = i; m < next_sep; ++m) */
+ {
+ size_t m = i;
curstep = &g_array_index(m_parse_steps, parse_value_t, m);
size_t try_len = std_lite::min
(m + max_full_pinyin_length, next_sep);
@@ -379,6 +381,7 @@ int FullPinyinParser2::parse (pinyin_option_t options, ChewingKeyVector & keys,
if (value.m_parsed_len == nextstep->m_parsed_len &&
value.m_num_keys < nextstep->m_num_keys)
*nextstep = value;
+
if (value.m_parsed_len == nextstep->m_parsed_len &&
value.m_num_keys == nextstep->m_num_keys) {
--
1.7.7.6

View File

@ -1,6 +1,6 @@
Name: libpinyin
Version: 0.5.91
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Library to deal with pinyin
License: GPLv2+
@ -83,6 +83,9 @@ find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
%{_mandir}/man1/*.1.*
%changelog
* Tue Feb 14 2012 Peng Wu <pwu@redhat.com> - 0.5.91-2
- Improves full pinyin parser2
* Mon Feb 13 2012 Peng Wu <pwu@redhat.com> - 0.5.91-1
- Update to 0.5.91