Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit 0238fb2240743281b9898084f7bfc5cb31e8261b
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Fri Jan 17 15:40:05 2014 +0100
Release 1.2.9
>---------------------------------------------------------------
ibus-typing-booster/ChangeLog | 11 +++++++++++
ibus-typing-booster/configure.ac | 2 +-
ibus-typing-booster/ibus-typing-booster.pc.in | 2 +-
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/ibus-typing-booster/ChangeLog b/ibus-typing-booster/ChangeLog
index d4d56be..5274b44 100644
--- a/ibus-typing-booster/ChangeLog
+++ b/ibus-typing-booster/ChangeLog
@@ -1,3 +1,14 @@
+* 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
+* Add timestamp support to user_transliteration.py
+* Use a single user database for all engines
+* Add *-inscript2 transliteration options to the Indian languages where these were still missing (Resolves: rhbz#1051405)
+* Make it possible to use multiple hunspell dictionaries at the same time
+* Make it possible to specify a list of dictionaries in the config files
+* Make it possible to get a word back into preëdit by using backspace (Resolves: rhbz#1032442)
+
* Author: Anish Patil <apatil(a)redhat.com>
* 20 Dec 2013 Released 1.2.8 version
* change of IME name for oriya language(#1045299)
diff --git a/ibus-typing-booster/configure.ac b/ibus-typing-booster/configure.ac
index dbee8ca..b8c6c3c 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], [8])
+m4_define([ibus_micro_version], [9])
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 c37c8cd..015a88b 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.8
+Version: 1.2.9
Requires:
Libs:
Cflags:
\ No newline at end of file
Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit 80892df55450b26a7b37904e51278de4893d4306
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Thu Dec 19 10:00:34 2013 +0100
Make it possible to get a word back into preëdit by using backspace
Resolves: rhbz#1032442 - [ibus-typing-booster][F20] - Support for the surrounding text needs to be implemented [RFE]
See: https://bugzilla.redhat.com/show_bug.cgi?id=1032442
Implemented *only* for backspace at the moment, not for the arrow keys.
Maybe I’ll do something for the arrow keys later, doing it
for the arrow keys is more tricky but I want to release now
what I already have.
>---------------------------------------------------------------
ibus-typing-booster/engine/hunspell_table.py | 34 ++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/ibus-typing-booster/engine/hunspell_table.py b/ibus-typing-booster/engine/hunspell_table.py
index 0aebd74..a3f65dd 100644
--- a/ibus-typing-booster/engine/hunspell_table.py
+++ b/ibus-typing-booster/engine/hunspell_table.py
@@ -758,6 +758,40 @@ class tabengine (IBus.Engine):
# if the first character is a space, just pass it through
# it makes not sense trying to complete:
return False
+ if key.code in (IBus.KEY_BackSpace,):
+ # When the end of a word is reached again by typing backspace,
+ # try to get that word back into preedit:
+ if not (self.client_capabilities & IBus.Capabilite.SURROUNDING_TEXT):
+ return False
+ surrounding_text = self.get_surrounding_text()
+ text = surrounding_text[0].get_text().decode('UTF-8')
+ cursor_pos = surrounding_text[1]
+ anchor_pos = surrounding_text[2]
+ if not surrounding_text:
+ return False
+ if not self._commit_happened_after_focus_in:
+ # Before the first commit or cursor movement, the
+ # surrounding text is probably from the previously
+ # focused window (bug!), don’t use it.
+ return False
+ pattern = re.compile(r'(^|.*[\s]+)(?P<token>[\S]+)[\s]$', re.UNICODE)
+ match = pattern.match(text[:cursor_pos])
+ if not match:
+ return False
+ # The pattern has matched, i.e. left of the cursor is
+ # a single whitespace and left of that a token was
+ # found. Delete the whitespace and the token from the
+ # application, get the context to the left of the
+ # token, put the token into the preedit again and
+ # update the candidates. Do not pass the backspace
+ # back to the application because the whitespace has
+ # already been deleted.
+ token = match.group('token')
+ self.delete_surrounding_text(-1-len(token),1+len(token))
+ self.get_context()
+ self._editor.insert_string_at_cursor(token)
+ self._update_ui()
+ return True
if key.code >= 32 and (not (key.mask & (IBus.ModifierType.MOD1_MASK | IBus.ModifierType.CONTROL_MASK))):
typed_character = IBus.keyval_to_unicode(key.code).decode('UTF-8')
# If the first character typed is a character which is
Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit e714cc80d51b887f3127f125edbbc9e5fb53ff92
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Fri Jan 17 11:45:09 2014 +0100
Make it possible to specify a list of dictionaries in the config files
The option “hunspell_dict” in the .conf files may now contain not
only a single dictionary but a list, i.e. something like
hunspell_dict = de_DE.dic, en_GB.dic
is now possible.
>---------------------------------------------------------------
ibus-typing-booster/engine/tabsqlitedb.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/ibus-typing-booster/engine/tabsqlitedb.py b/ibus-typing-booster/engine/tabsqlitedb.py
index 39b0deb..0dd5d04 100755
--- a/ibus-typing-booster/engine/tabsqlitedb.py
+++ b/ibus-typing-booster/engine/tabsqlitedb.py
@@ -90,7 +90,7 @@ class tabsqlitedb:
self._normalization_form_internal = 'NFD'
self.hunspell_obj = hunspell_suggest.Hunspell(
- dictionary_names=[self.ime_properties.get("hunspell_dict").replace('.dic', '')])
+ dictionary_names=self.ime_properties.get("hunspell_dict").replace('.dic', '').split(', '))
user_db = 'user.db'
# user database:
Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit 6f769b4399c5d11189ebec3d2f80c65b6fe7a59c
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Tue Jan 14 16:08:26 2014 +0100
Make it possible to use multiple hunspell dictionaries at the same time
There is no support in the setup UI for this yet, neither is there
support in the config files, but the code in hunspell_suggest.py has
been generalized now to handle a list of dictionaries instead of only
one.
>---------------------------------------------------------------
ibus-typing-booster/engine/hunspell_suggest.py | 156 ++++++++++++------------
ibus-typing-booster/engine/hunspell_table.py | 7 +-
ibus-typing-booster/engine/tabsqlitedb.py | 2 +-
3 files changed, 85 insertions(+), 80 deletions(-)
diff --git a/ibus-typing-booster/engine/hunspell_suggest.py b/ibus-typing-booster/engine/hunspell_suggest.py
index 6a24fea..45e9a74 100755
--- a/ibus-typing-booster/engine/hunspell_suggest.py
+++ b/ibus-typing-booster/engine/hunspell_suggest.py
@@ -37,71 +37,87 @@ except:
max_words = 100
max_words_row = 50
-class Hunspell:
- def __init__(self,loc='/usr/share/myspell/',dict_name='en_US'):
- self.normalization_form_internal = 'NFD'
- self.loc = loc
- self.dict_name = dict_name + '.dic'
- self.aff_name = dict_name + '.aff'
+normalization_form_internal = 'NFD'
+
+class Dictionary:
+ def __init__(self, name=u'en_US'):
+ self.loc = '/usr/share/myspell'
+ self.name = name
self.encoding = 'UTF-8'
- self.dict_buffer = None
- self.aff_buffer = None
+ self.buffer = None
+ self.pyhunspell_object = None
self.load_dictionary()
def load_dictionary(self):
- self.encoding = 'UTF-8'
- self.dict_buffer = None
- self.aff_buffer = None
- self.pyhunspell_object = None
print "load_dictionary() ..."
- if not os.path.isfile(self.loc+self.dict_name) or not os.path.isfile(self.loc+self.aff_name):
- print "load_dictionary(): .dic or .aff file missing."
+ dic_path = os.path.join(self.loc, self.name+'.dic')
+ aff_path = os.path.join(self.loc, self.name+'.aff')
+ if not os.path.isfile(dic_path) or not os.path.isfile(aff_path):
+ print("load_dictionary %(n)s: %(d)s %(a)s file missing."
+ %{'n': self.name, 'd': dic_path, 'a': aff_path})
return
try:
- self.aff_buffer = open(
- self.loc+self.aff_name).read().replace('\r\n', '\n')
+ aff_buffer = open(aff_path).read().replace('\r\n', '\n')
except:
import traceback
traceback.print_exc()
- if self.aff_buffer:
+ if aff_buffer:
encoding_pattern = re.compile(
r'^[\s]*SET[\s]+(?P<encoding>[-a-zA-Z0-9_]+)[\s]*$',
re.MULTILINE|re.UNICODE)
- match = encoding_pattern.search(self.aff_buffer)
+ match = encoding_pattern.search(aff_buffer)
if match:
self.encoding = match.group('encoding')
print "load_dictionary(): encoding=%(enc)s found in %(aff)s" %{
- 'enc': self.encoding, 'aff': self.loc+self.aff_name}
+ 'enc': self.encoding, 'aff': aff_path}
try:
- self.dict_buffer = codecs.open(
- self.loc+self.dict_name).read().decode(self.encoding).replace('\r\n', '\n')
+ self.buffer = codecs.open(
+ dic_path).read().decode(self.encoding).replace('\r\n', '\n')
except:
print "load_dictionary(): loading %(dic)s as %(enc)s encoding failed, fall back to ISO-8859-1." %{
- 'dic': self.loc+self.dict_name, 'enc': self.encoding}
+ 'dic': dic_path, 'enc': self.encoding}
self.encoding = 'ISO-8859-1'
try:
- self.dict_buffer = codecs.open(
- self.loc+self.dict_name).read().decode(self.encoding).replace('\r\n', '\n')
+ self.buffer = codecs.open(
+ dic_path).read().decode(self.encoding).replace('\r\n', '\n')
except:
- print "load_dictionary(): loading %(dic)s as %(enc)s encoding failed, giving up." %{
- 'dic': self.loc+self.dict_name, 'enc': self.encoding}
- self.dict_buffer = None
- self.aff_buffer = None
+ print("load_dictionary(): loading %(dic)s as %(enc)s encoding failed, giving up." %{
+ 'dic': dic_path, 'enc': self.encoding})
+ self.buffer = None
import traceback
traceback.print_exc()
- if self.dict_buffer:
- self.dict_buffer = unicodedata.normalize(
- self.normalization_form_internal, self.dict_buffer)
- if import_hunspell_successful:
- self.pyhunspell_object = hunspell.HunSpell(
- self.loc+self.dict_name,
- self.loc+self.aff_name)
- else:
- self.pyhunspell_object = None
+ return
+ 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
+
+class Hunspell:
+ def __init__(self, dictionary_names=['en_US']):
+ self.dictionary_names = dictionary_names
+ self.load_dictionaries()
+
+ def load_dictionaries(self):
+ self.dictionaries = []
+ for dictionary_name in self.dictionary_names:
+ self.dictionaries.append(Dictionary(name=dictionary_name))
- def words_start(self,word):
- if type(word) != type(u''):
- word = word.decode('utf8')
+ def suggest(self, input_phrase):
+ # If the input phrase is very long, don’t try looking
+ # something up in the hunspell dictionaries. The regexp match
+ # gets very slow if the input phrase is very long. And there
+ # are no very long words in the hunspell dictionaries anyway,
+ # the longest word in the German hunspell dictionary currently
+ # seems to be “Geschwindigkeitsübertretungsverfahren” trying
+ # to match words longer than that just wastes time.
+ if len(input_phrase) > 40:
+ return []
+ if type(input_phrase) != type(u''):
+ input_phrase = input_phrase.decode('utf8')
# http://pwet.fr/man/linux/fichiers_speciaux/hunspell says:
#
# > A dictionary file (*.dic) contains a list of words, one per
@@ -113,49 +129,37 @@ class Hunspell:
# I.e. if '/' is already contained in the input, it cannot
# match a word in the dictionary and we return an empty list
# immediately:
- if '/' in word:
+ if '/' in input_phrase:
return []
# And we should not match further than '/'.
# Take care to use a non-greedy regexp to match only
# one line and not accidentally big chunks of the file!
try:
- regexp = r'^'+re.escape(word)+r'.*?(?=/|$)'
+ regexp = r'^'+re.escape(input_phrase)+r'.*?(?=/|$)'
patt_start = re.compile(regexp,re.MULTILINE|re.UNICODE)
except:
import traceback
traceback.print_exc()
- if self.dict_buffer != None:
- start_words = patt_start.findall(self.dict_buffer)
- if self.pyhunspell_object != None:
- if len(word) >= 4:
- # Always pass NFC to pyhunspell and convert the
- # result back to NFKD, even for Korean (For
- # Korean, hunspell does a NFC -> NFKD conversion
- # of the input and NFKD->NFC conversion of the
- # output)
- word = unicodedata.normalize('NFC', word)
- extra_suggestions = map(
- lambda x: unicodedata.normalize(
- self.normalization_form_internal, x.decode(self.encoding)),
- self.pyhunspell_object.suggest(word.encode(self.encoding, 'replace')))
- for suggestion in extra_suggestions:
- if suggestion not in start_words:
- start_words.append(suggestion)
- else:
- start_words = [u'☹ %(loc)s%(dict_name)s not found.' %{'loc': self.loc, 'dict_name': self.dict_name}, u'☹ please install hunspell dictionary!']
- return list(set(start_words[0:max_words]))
-
- def suggest(self, input_phrase):
- # If the input phrase is very long, don’t try looking
- # something up in the hunspell dictionaries. The regexp match
- # gets very slow if the input phrase is very long. And there
- # are no very long words in the hunspell dictionaries anyway,
- # the longest word in the German hunspell dictionary currently
- # seems to be “Geschwindigkeitsübertretungsverfahren” trying
- # to match words longer than that just wastes time.
- if len(input_phrase) > 40:
- return []
- return self.words_start(input_phrase)
-
-
+ suggested_words = []
+ for dictionary in self.dictionaries:
+ if dictionary.buffer:
+ suggested_words += patt_start.findall(dictionary.buffer)
+ if dictionary.pyhunspell_object:
+ if len(input_phrase) >= 4:
+ # Always pass NFC to pyhunspell and convert the
+ # result back to the internal normalization form (NFD)
+ # (hunspell does the right thing for Korean if the input is NFC).
+ input_phrase = unicodedata.normalize('NFC', input_phrase)
+ extra_suggestions = map(
+ lambda x: unicodedata.normalize(
+ normalization_form_internal, x.decode(dictionary.encoding)),
+ dictionary.pyhunspell_object.suggest(input_phrase.encode(dictionary.encoding, 'replace')))
+ for suggestion in extra_suggestions:
+ if suggestion not in suggested_words:
+ suggested_words.append(suggestion)
+ else:
+ dic_path = os.path.join(dictionary.loc, dictionary.name+'.dic')
+ suggested_words.insert(
+ 0, u'☹ %(dic_path)s not found. Please install hunspell dictionary!' %{'dic_path': dic_path})
+ return suggested_words[0:max_words]
diff --git a/ibus-typing-booster/engine/hunspell_table.py b/ibus-typing-booster/engine/hunspell_table.py
index d9d6a0c..0aebd74 100644
--- a/ibus-typing-booster/engine/hunspell_table.py
+++ b/ibus-typing-booster/engine/hunspell_table.py
@@ -1068,8 +1068,9 @@ class tabengine (IBus.Engine):
self.reset()
return
if name == "dictionaryinstalltimestamp":
- # The dictionary has bin updated or installed, (re)load it:
- print "Reloading dictionary ..."
- self.db.hunspell_obj.load_dictionary()
+ # A dictionary has bin updated or installed,
+ # (re)load all dictionaries:
+ print "Reloading dictionaries ..."
+ self.db.hunspell_obj.load_dictionaries()
self.reset()
return
diff --git a/ibus-typing-booster/engine/tabsqlitedb.py b/ibus-typing-booster/engine/tabsqlitedb.py
index a8bac2f..39b0deb 100755
--- a/ibus-typing-booster/engine/tabsqlitedb.py
+++ b/ibus-typing-booster/engine/tabsqlitedb.py
@@ -90,7 +90,7 @@ class tabsqlitedb:
self._normalization_form_internal = 'NFD'
self.hunspell_obj = hunspell_suggest.Hunspell(
- dict_name=self.ime_properties.get("hunspell_dict").replace('.dic', ''))
+ dictionary_names=[self.ime_properties.get("hunspell_dict").replace('.dic', '')])
user_db = 'user.db'
# user database:
Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit 9392219d79b951b3243a8455b928e581cc8f72c4
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Fri Sep 27 16:51:21 2013 +0200
Use a single user database for all engines
To make ibus-typing-booster more multilingual, it is useful to add
trigrams always to the same user database for all languages. For
example, when trigrams are added to the user database while typing
English, they do not really hurt when typing German later. If the
previous two words are German, English trigrams will just not
match. But this makes it possible to switch automatically to typing
English while staying with the German engine. Just typing a few
English words while still using the German engines makes the English
trigrams match again. So this gives automatic language switching for
the user trigrams for all engines using Latin script.
>---------------------------------------------------------------
ibus-typing-booster/engine/tabsqlitedb.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/ibus-typing-booster/engine/tabsqlitedb.py b/ibus-typing-booster/engine/tabsqlitedb.py
index 2f55a66..a8bac2f 100755
--- a/ibus-typing-booster/engine/tabsqlitedb.py
+++ b/ibus-typing-booster/engine/tabsqlitedb.py
@@ -92,7 +92,7 @@ class tabsqlitedb:
self.hunspell_obj = hunspell_suggest.Hunspell(
dict_name=self.ime_properties.get("hunspell_dict").replace('.dic', ''))
- user_db = self.ime_properties.get("name")+'-user.db'
+ user_db = 'user.db'
# user database:
if user_db != None:
home_path = os.getenv ("HOME")
Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit 99dc05abae00f0425ac65651d96281e28dd42e1a
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Tue Jan 7 12:58:15 2014 +0100
Fix behaviour of arrow right keys in preëdit
Resolves: rhbz#1049324 - Using the arrow right key in preëdit does work correctly, it moves the preëdit to the right
See: https://bugzilla.redhat.com/show_bug.cgi?id=1049324
>---------------------------------------------------------------
ibus-typing-booster/engine/hunspell_table.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ibus-typing-booster/engine/hunspell_table.py b/ibus-typing-booster/engine/hunspell_table.py
index d02fc36..d9d6a0c 100644
--- a/ibus-typing-booster/engine/hunspell_table.py
+++ b/ibus-typing-booster/engine/hunspell_table.py
@@ -853,9 +853,9 @@ class tabengine (IBus.Engine):
if key.code in (IBus.KEY_Right, IBus.KEY_KP_Right):
if self._editor.is_empty():
return False
- res = self._editor.arrow_right ()
+ self._editor.arrow_right ()
self._update_ui ()
- return res
+ return True
if key.code == IBus.KEY_BackSpace and key.mask & IBus.ModifierType.CONTROL_MASK:
if self._editor.is_empty():