Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit f581795a4dfa6df61d86e9d97f0c404538894978
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Thu Feb 27 15:26:06 2014 +0100
Release 1.2.10
>---------------------------------------------------------------
ibus-typing-booster/ChangeLog | 9 +++++++++
ibus-typing-booster/configure.ac | 2 +-
ibus-typing-booster/ibus-typing-booster.pc.in | 2 +-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/ibus-typing-booster/ChangeLog b/ibus-typing-booster/ChangeLog
index 5274b44..da68d3e 100644
--- a/ibus-typing-booster/ChangeLog
+++ b/ibus-typing-booster/ChangeLog
@@ -1,4 +1,13 @@
* Author: Mike FABIAN <mfabian(a)redhat.com>
+* 27 Feb 2014 Released 1.2.10 version
+* make profiling work again and make it easier to use
+* tiny performance improvement
+* some code simplification
+* port from Python2 to Python3
+* minor improvements in user_transliteration.py
+* add python-enchant support
+
+* Author: Mike FABIAN <mfabian(a)redhat.com>
* 17 Jan 2014 Released 1.2.9 version
* Fix behaviour of arrow right keys in preëdit (Resolves: rhbz#1049324)
* Add timestamps to entries in the user database
diff --git a/ibus-typing-booster/configure.ac b/ibus-typing-booster/configure.ac
index b8c6c3c..b28eb7a 100755
--- a/ibus-typing-booster/configure.ac
+++ b/ibus-typing-booster/configure.ac
@@ -24,7 +24,7 @@ m4_define([package_name], [ibus-typing-booster])
m4_define([ibus_released], [1])
m4_define([ibus_major_version], [1])
m4_define([ibus_minor_version], [2])
-m4_define([ibus_micro_version], [9])
+m4_define([ibus_micro_version], [10])
m4_define(ibus_maybe_datestamp,
m4_esyscmd([if test x]ibus_released[ != x1; then date +.%Y%m%d | tr -d '\n\r'; fi]))
diff --git a/ibus-typing-booster/ibus-typing-booster.pc.in b/ibus-typing-booster/ibus-typing-booster.pc.in
index 015a88b..9a89c5d 100755
--- a/ibus-typing-booster/ibus-typing-booster.pc.in
+++ b/ibus-typing-booster/ibus-typing-booster.pc.in
@@ -11,7 +11,7 @@ enginedir=/usr/share/ibus/engine
Name: IBus-Typing-Booster
Description: Table Based Input Method Framework for Intelligent Input Bus for Linux / Unix OS
-Version: 1.2.9
+Version: 1.2.10
Requires:
Libs:
Cflags:
\ No newline at end of file
Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit a777d34304808156897ff781d74995c547899f82
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Fri Feb 28 09:15:27 2014 +0100
Add python-enchant support
pyhunspell is not available for Python3. python-enchant is available
both for Python2 and for Python3.
So we need python-enchant because of the Python3 port anyway.
And python-enchant actually also seems to work slightly better then
pyhunspell, it takes Unicode as input and returns Unicode whereas
pyhunspell needs its input in the encoding of the hunspell dictionary.
So in case of pyhunspell, ibus-typing-booster has to do some extra
encoding conversion.
>---------------------------------------------------------------
ibus-typing-booster/engine/hunspell_suggest.py | 45 +++++++++++++++++++-----
1 files changed, 36 insertions(+), 9 deletions(-)
diff --git a/ibus-typing-booster/engine/hunspell_suggest.py b/ibus-typing-booster/engine/hunspell_suggest.py
index 7a9f2e2..d04895d 100755
--- a/ibus-typing-booster/engine/hunspell_suggest.py
+++ b/ibus-typing-booster/engine/hunspell_suggest.py
@@ -22,11 +22,18 @@ import sys
import unicodedata
import re
import codecs
+
+import_enchant_successful = False
+import_hunspell_successful = False
try:
- import hunspell
- import_hunspell_successful = True
+ import enchant
+ import_enchant_successful = True
except:
- import_hunspell_successful = False
+ try:
+ import hunspell # only available for Python2
+ import_hunspell_successful = True
+ except:
+ pass
# Maximum words that should be returned.
# This should a rather big number in order not
@@ -45,6 +52,7 @@ class Dictionary:
self.name = name
self.encoding = 'UTF-8'
self.buffer = None
+ self.enchant_dict = None
self.pyhunspell_object = None
self.load_dictionary()
@@ -90,11 +98,10 @@ class Dictionary:
if self.buffer:
self.buffer = unicodedata.normalize(
normalization_form_internal, self.buffer)
- if import_hunspell_successful:
- self.pyhunspell_object = hunspell.HunSpell(
- dic_path, aff_path)
- else:
- self.pyhunspell_object = None
+ if import_enchant_successful:
+ self.enchant_dict = enchant.Dict(self.name)
+ elif import_hunspell_successful:
+ self.pyhunspell_object = hunspell.HunSpell(dic_path, aff_path)
class Hunspell:
def __init__(self, dictionary_names=['en_US']):
@@ -144,7 +151,27 @@ class Hunspell:
for dictionary in self.dictionaries:
if dictionary.buffer:
suggested_words += patt_start.findall(dictionary.buffer)
- if dictionary.pyhunspell_object:
+ if dictionary.enchant_dict:
+ if len(input_phrase) >= 4:
+ # Always pass NFC to enchant and convert the
+ # result back to the internal normalization form (NFD)
+ # (enchant does the right thing for Korean if the input is NFC).
+ # enchant takes unicode strings and returns unicode strings,
+ # no encoding and decoding to and from the hunspell dictionary
+ # encoding is necessary (neither for Python2 nor Python3).
+ # (pyhunspell (which works only for Python2) needs to get
+ # its input passed in dictionary encoding and also returns it in
+ # dictionary encoding).
+ input_phrase = unicodedata.normalize('NFC', input_phrase)
+ extra_suggestions = [
+ unicodedata.normalize(normalization_form_internal, x)
+ for x in
+ dictionary.enchant_dict.suggest(input_phrase)
+ ]
+ for suggestion in extra_suggestions:
+ if suggestion not in suggested_words:
+ suggested_words.append(suggestion)
+ elif dictionary.pyhunspell_object:
if len(input_phrase) >= 4:
# Always pass NFC to pyhunspell and convert the
# result back to the internal normalization form (NFD)
Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit 2022f74dc579a204574f0f7e4ff9234c756e4183
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Thu Feb 27 11:47:26 2014 +0100
Make it possible to use full path names or only the basenames as arguments for user_transliteration.py
>---------------------------------------------------------------
ibus-typing-booster/setup/user_transliteration.py | 26 +++++++++++++--------
1 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/ibus-typing-booster/setup/user_transliteration.py b/ibus-typing-booster/setup/user_transliteration.py
index 687266d..137e617 100755
--- a/ibus-typing-booster/setup/user_transliteration.py
+++ b/ibus-typing-booster/setup/user_transliteration.py
@@ -3,7 +3,7 @@
#
# ibus-typing-booster - The Tables engine for IBus
#
-# Copyright (c) 2012-2013 Anish Patil <apatil(a)redhat.com>
+# Copyright (c) 2012-2014 Anish Patil <apatil(a)redhat.com>
# Copyright (c) 2014 Mike FABIAN <mfabian(a)redhat.com>
#
# This program is free software: you can redistribute it and/or modify
@@ -182,17 +182,17 @@ class LatinConvert:
import argparse
parser = argparse.ArgumentParser(
- description='translit')
+ description='Transliterate a hunspell dictionary to Latin script and insert it into the user database. Currently works only for mr_IN.dic.')
parser.add_argument('-u', '--userdictionary',
nargs='?',
type=str,
default='',
- help='user dictionary')
+ help='user dictionary. For example ~/.local/share/ibus-typing-booster/user.db. A full path can be given or only the basename. When only the basename is given, ~/.local/share/ibus-typing-booster/ is prepended automatically.')
parser.add_argument('-d', '--hunspelldict',
nargs='?',
type=str,
default='',
- help='hunspell file path')
+ help='hunspell file path. For example /usr/share/myspell/mr_IN.dic. A full path can be given or only the basename. When only the basename is given, /usr/share/myspell/ is prepended automatically.')
args = parser.parse_args()
def main():
@@ -201,12 +201,15 @@ def main():
sys.exit(1)
user_dict = args.userdictionary
hunspell_dict = args.hunspelldict
- dict_name = args.hunspelldict
if user_dict:
#check whether user dict exists in the path
home_path = os.getenv ("HOME")
tables_path = path.join (home_path, ".local/share/ibus-typing-booster")
- user_dict = path.join (tables_path, user_dict)
+ if '/' not in user_dict:
+ # if user_dict already contains a '/' full path was given
+ # on the command line. If there is no '/', it is only the file
+ # name, add the default path:
+ user_dict = path.join (tables_path, user_dict)
if not path.exists(user_dict):
sys.stderr.write(
"The user database %(udb)s does not exist .\n" %{'udb': user_dict})
@@ -214,16 +217,19 @@ def main():
if hunspell_dict:
# Not sure how to get hunspell dict path from env
hunspell_path = "/usr/share/myspell/"
- hunspell_dict = path.join(hunspell_path,hunspell_dict)
+ if '/' not in hunspell_dict:
+ # if hunspell_dict already contains a '/' full path was given
+ # on the command line. If there is no '/', it is only the file
+ # name, add the default path:
+ hunspell_dict = path.join(hunspell_path,hunspell_dict)
if not path.exists(hunspell_dict):
sys.stderr.write(
"The hunspell dictionary %(hud)s does not exists .\n" %{'hud': hunspell_dict})
sys.exit(1)
- aff_name = hunspell_dict.replace('.dic','.aff')
lt = LatinConvert(user_dict,
hunspell_dict,
- aff_name,
- dict_name)
+ hunspell_dict.replace('.dic', '.aff'),
+ os.path.basename(hunspell_dict))
lt.insert_into_db()
if __name__ == '__main__':