然后修改engine里的pysqlitedb.py:
代码: 全选
#添加到头部
import re
import urllib
#函数修改
def select_words_by_pinyin_list (self, pys, mohu = False):
"""select words from database by list that contains pyutil.PinYinWord objects"""
pinyin_string = u"'".join (map (str, pys))
result = self.select_cache [pinyin_string]
if result != None:
return result
doc = urllib.urlopen("http://web.pinyin.sogou.com/web_ime/get_ajax/%s.key" % pinyin_string).read()
words = map(urllib.unquote,re.compile(r'ime_query_res="([^"]*)"').match(doc).group(1).split('+'))
result = []
for word in words:
phrase = word.split(':')[0].decode('utf8');
record = (len(phrase), None, None, None, None, '', None, None, None, None, phrase, 1, 1)
result.append(record)
self.select_cache [pinyin_string] = result
return result
第一,目前不熟python,现查手册改的。
第二,只用了1个小时随便改改,本来想自用的,所以只是在原来的sqlite的基础上蒙蔽下程序。结果发现太好用了,忍不住发上来。由于ibus-pinyin有缓存,比sogoupinyincc要快很多很多并且可以选词,几乎感觉不到延迟。
我觉得接下来可以基于ibus-pinyin做一个搜狗云输入法的完善的补丁了。
============================================================================================================
12月2号更新:修改了一下,使网速突然减慢的情况下可以不用等待网络,直接调用本地词库,下载了force reinstall就可以了。
不区分32位和64位。
http://dl.dropbox.com/u/444392/ibus-pin ... u2_all.deb