Update to 1.4.2

This commit is contained in:
Peng Wu 2012-08-06 15:14:07 +08:00
parent 1ae7348936
commit 32b13cf21f
4 changed files with 10 additions and 278 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
/ibus-libpinyin-1.4.0.tar.gz
/ibus-libpinyin-1.4.1.tar.gz
/ibus-libpinyin-1.4.2.tar.gz

View File

@ -1,275 +0,0 @@
From e16682240d6df8777a7b6605811258b5ec71cec1 Mon Sep 17 00:00:00 2001
From: Peng Wu <alexepico@gmail.com>
Date: Wed, 4 Jul 2012 13:19:47 +0800
Subject: [PATCH 1/7] fixes fillLookupTableByPage
---
src/PYPPhoneticEditor.cc | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/src/PYPPhoneticEditor.cc b/src/PYPPhoneticEditor.cc
index bdc05d8..a9b81ce 100644
--- a/src/PYPPhoneticEditor.cc
+++ b/src/PYPPhoneticEditor.cc
@@ -204,7 +204,7 @@ LibPinyinPhoneticEditor::fillLookupTableByPage (void)
if (need_nr == 0)
return FALSE;
- String word, phrase_string;
+ String word;
for (guint i = filled_nr; i < filled_nr + need_nr; i++) {
if (i >= m_candidates->len) /* no more candidates */
break;
@@ -212,14 +212,7 @@ LibPinyinPhoneticEditor::fillLookupTableByPage (void)
lookup_candidate_t * candidate = &g_array_index
(m_candidates, lookup_candidate_t, i);
- phrase_string = candidate->m_phrase_string;
-
- if (BEST_MATCH_CANDIDATE == candidate->m_candidate_type) {
- /* hide selected part */
- guint cursor = getLookupCursor ();
- phrase_string = g_utf8_offset_to_pointer
- (candidate->m_phrase_string, cursor);
- }
+ const gchar * phrase_string = candidate->m_phrase_string;
/* show get candidates. */
if (G_LIKELY (m_props.modeSimp ())) {
--
1.7.10.4
From a742f0e61a9cc81ee14f5d66070bede4a737fa18 Mon Sep 17 00:00:00 2001
From: Peng Wu <alexepico@gmail.com>
Date: Wed, 4 Jul 2012 15:19:05 +0800
Subject: [PATCH 2/7] uses pinyin_load_phrase_library
---
src/PYLibPinyin.cc | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/PYLibPinyin.cc b/src/PYLibPinyin.cc
index dd56fa7..621863b 100644
--- a/src/PYLibPinyin.cc
+++ b/src/PYLibPinyin.cc
@@ -64,6 +64,7 @@ LibPinyinBackEnd::allocPinyinInstance ()
g_free(userdir); userdir = NULL;
}
m_pinyin_context = pinyin_init ("/usr/share/libpinyin/data", userdir);
+ pinyin_load_phrase_library(m_pinyin_context, 2);
g_free(userdir);
}
@@ -87,7 +88,8 @@ LibPinyinBackEnd::allocChewingInstance ()
if (retval) {
g_free(userdir); userdir = NULL;
}
- m_chewing_context = pinyin_init ("/usr/share/libpinyin/data", NULL);
+ m_chewing_context = pinyin_init ("/usr/share/libpinyin/data", userdir);
+ pinyin_load_phrase_library(m_chewing_context, 2);
g_free(userdir);
}
--
1.7.10.4
From 155103f5528d450c05c8639c64c8fef2cb9e52bd Mon Sep 17 00:00:00 2001
From: Peng Wu <alexepico@gmail.com>
Date: Mon, 9 Jul 2012 13:11:45 +0800
Subject: [PATCH 3/7] fixes selectCandidate
---
src/PYPPhoneticEditor.cc | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/PYPPhoneticEditor.cc b/src/PYPPhoneticEditor.cc
index a9b81ce..13e6011 100644
--- a/src/PYPPhoneticEditor.cc
+++ b/src/PYPPhoneticEditor.cc
@@ -363,10 +363,15 @@ LibPinyinPhoneticEditor::selectCandidate (guint i)
lookup_cursor = pinyin_choose_candidate
(m_instance, lookup_cursor, candidate);
+ if (DIVIDED_CANDIDATE == candidate->m_candidate_type ||
+ RESPLIT_CANDIDATE == candidate->m_candidate_type) {
+ m_text = m_instance->m_raw_full_pinyin;
+ }
pinyin_guess_sentence (m_instance);
PinyinKeyPosVector & pinyin_poses = m_instance->m_pinyin_key_rests;
if (lookup_cursor == pinyin_poses->len) {
+ pinyin_train(m_instance);
commit();
return TRUE;
}
--
1.7.10.4
From 87c19323a056947e42b573e92dfd4e29e320d99b Mon Sep 17 00:00:00 2001
From: Peng Wu <alexepico@gmail.com>
Date: Mon, 9 Jul 2012 13:20:15 +0800
Subject: [PATCH 4/7] improves full pinyin mode
---
src/PYPFullPinyinEditor.cc | 11 +++++++++++
src/PYPFullPinyinEditor.h | 4 ++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/PYPFullPinyinEditor.cc b/src/PYPFullPinyinEditor.cc
index 00e3077..90e3f2f 100644
--- a/src/PYPFullPinyinEditor.cc
+++ b/src/PYPFullPinyinEditor.cc
@@ -125,3 +125,14 @@ LibPinyinFullPinyinEditor::updateAuxiliaryText ()
StaticText aux_text (m_buffer);
Editor::updateAuxiliaryText (aux_text, TRUE);
}
+
+void
+LibPinyinFullPinyinEditor::update (void)
+{
+ guint lookup_cursor = getLookupCursor ();
+ pinyin_get_full_pinyin_candidates (m_instance, lookup_cursor, m_candidates);
+
+ updateLookupTable ();
+ updatePreeditText ();
+ updateAuxiliaryText ();
+}
diff --git a/src/PYPFullPinyinEditor.h b/src/PYPFullPinyinEditor.h
index a3b3df4..bb92655 100644
--- a/src/PYPFullPinyinEditor.h
+++ b/src/PYPFullPinyinEditor.h
@@ -38,10 +38,10 @@ public:
virtual gboolean processKeyEvent (guint keyval, guint keycode, guint modifiers);
virtual void reset (void);
virtual void updateAuxiliaryText (void);
-
+ virtual void update (void);
protected:
- /* TODO: to be implemented. */
+
virtual void updatePinyin (void);
};
--
1.7.10.4
From a727155dc7dfeac0ac52e89c101003b9b2481a86 Mon Sep 17 00:00:00 2001
From: Peng Wu <alexepico@gmail.com>
Date: Mon, 9 Jul 2012 13:29:18 +0800
Subject: [PATCH 5/7] use divided table for full pinyin
---
src/PYLibPinyin.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/PYLibPinyin.cc b/src/PYLibPinyin.cc
index 621863b..44dcaf2 100644
--- a/src/PYLibPinyin.cc
+++ b/src/PYLibPinyin.cc
@@ -143,7 +143,8 @@ LibPinyinBackEnd::setPinyinOptions (Config *config)
}
}
- pinyin_option_t options = config->option() | USE_RESPLIT_TABLE;
+ pinyin_option_t options = config->option()
+ | USE_RESPLIT_TABLE | USE_DIVIDED_TABLE;
pinyin_set_options (m_pinyin_context, options);
return TRUE;
}
--
1.7.10.4
From 2d8a65fdcefe0a8809740adb86f3d45d8c454793 Mon Sep 17 00:00:00 2001
From: Peng Wu <alexepico@gmail.com>
Date: Mon, 9 Jul 2012 15:50:04 +0800
Subject: [PATCH 6/7] fixes updatePinyin
---
src/PYPBopomofoEditor.cc | 1 +
src/PYPDoublePinyinEditor.cc | 1 +
src/PYPFullPinyinEditor.cc | 1 +
src/PYPPhoneticEditor.cc | 1 +
4 files changed, 4 insertions(+)
diff --git a/src/PYPBopomofoEditor.cc b/src/PYPBopomofoEditor.cc
index 331a651..1f201b5 100644
--- a/src/PYPBopomofoEditor.cc
+++ b/src/PYPBopomofoEditor.cc
@@ -241,6 +241,7 @@ LibPinyinBopomofoEditor::updatePinyin (void)
m_pinyin_len = 0;
/* TODO: check whether to replace "" with NULL. */
pinyin_parse_more_chewings (m_instance, "");
+ pinyin_guess_sentence(m_instance);
return;
}
diff --git a/src/PYPDoublePinyinEditor.cc b/src/PYPDoublePinyinEditor.cc
index 8a39a42..7e690f4 100644
--- a/src/PYPDoublePinyinEditor.cc
+++ b/src/PYPDoublePinyinEditor.cc
@@ -103,6 +103,7 @@ LibPinyinDoublePinyinEditor::updatePinyin (void)
m_pinyin_len = 0;
/* TODO: check whether to replace "" with NULL. */
pinyin_parse_more_double_pinyins (m_instance, "");
+ pinyin_guess_sentence(m_instance);
return;
}
diff --git a/src/PYPFullPinyinEditor.cc b/src/PYPFullPinyinEditor.cc
index 90e3f2f..eb58b6b 100644
--- a/src/PYPFullPinyinEditor.cc
+++ b/src/PYPFullPinyinEditor.cc
@@ -74,6 +74,7 @@ LibPinyinFullPinyinEditor::updatePinyin (void)
m_pinyin_len = 0;
/* TODO: check whether to replace "" with NULL. */
pinyin_parse_more_full_pinyins (m_instance, "");
+ pinyin_guess_sentence(m_instance);
return;
}
diff --git a/src/PYPPhoneticEditor.cc b/src/PYPPhoneticEditor.cc
index 13e6011..5e47be3 100644
--- a/src/PYPPhoneticEditor.cc
+++ b/src/PYPPhoneticEditor.cc
@@ -339,6 +339,7 @@ LibPinyinPhoneticEditor::getLookupCursor (void)
{
PinyinKeyVector & pinyins = m_instance->m_pinyin_keys;
guint lookup_cursor = getPinyinCursor ();
+
/* show candidates when pinyin cursor is at end. */
if (lookup_cursor == pinyins->len && m_pinyin_len == m_text.length())
lookup_cursor = 0;
--
1.7.10.4
From 9634aef4f33bca66f1634f305860131c22c722ac Mon Sep 17 00:00:00 2001
From: Peng Wu <alexepico@gmail.com>
Date: Tue, 10 Jul 2012 14:00:14 +0800
Subject: [PATCH 7/7] fixes selectCandidate for full pinyin
---
src/PYPPhoneticEditor.cc | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/PYPPhoneticEditor.cc b/src/PYPPhoneticEditor.cc
index 5e47be3..b89db91 100644
--- a/src/PYPPhoneticEditor.cc
+++ b/src/PYPPhoneticEditor.cc
@@ -367,6 +367,7 @@ LibPinyinPhoneticEditor::selectCandidate (guint i)
if (DIVIDED_CANDIDATE == candidate->m_candidate_type ||
RESPLIT_CANDIDATE == candidate->m_candidate_type) {
m_text = m_instance->m_raw_full_pinyin;
+ updatePinyin ();
}
pinyin_guess_sentence (m_instance);
--
1.7.10.4

View File

@ -1,6 +1,6 @@
Name: ibus-libpinyin
Version: 1.4.1
Release: 5%{?dist}
Version: 1.4.2
Release: 1%{?dist}
Summary: Intelligent Pinyin engine based on libpinyin for IBus
License: GPLv2+
Group: System Environment/Libraries
@ -55,6 +55,8 @@ rm -rf $RPM_BUILD_ROOT
%files -f %{name}.lang
%defattr(-,root,root,-)
%doc AUTHORS COPYING README
%{_datadir}/applications/ibus-setup-libpinyin.desktop
%{_datadir}/applications/ibus-setup-libbopomofo.desktop
%{_libexecdir}/ibus-engine-libpinyin
%{_libexecdir}/ibus-setup-libpinyin
%{_datadir}/ibus-libpinyin/phrases.txt
@ -62,11 +64,15 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/ibus-libpinyin/setup
%{_datadir}/ibus-libpinyin/base.lua
%{_datadir}/ibus-libpinyin/db/english.db
%{_datadir}/ibus-libpinyin/db/strokes.db
%dir %{_datadir}/ibus-libpinyin
%dir %{_datadir}/ibus-libpinyin/db
%{_datadir}/ibus/component/*
%changelog
* Mon Aug 06 2012 Peng Wu <pwu@redhat.com> - 1.4.2-1
- Update to 1.4.2
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

View File

@ -1 +1 @@
89347f0a255edcc83abf51a63d0e7bb9 ibus-libpinyin-1.4.1.tar.gz
ec67f2ef434769050a115cd80f56c6d1 ibus-libpinyin-1.4.2.tar.gz