Created
December 17, 2017 10:03
-
-
Save z-rui/6df2405d2eda6020f8539a8a135dcd88 to your computer and use it in GitHub Desktop.
ibus-table-1.9.18 构词码补丁
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/engine/tabsqlitedb.py b/engine/tabsqlitedb.py | |
index 26d1f7f..b555adb 100644 | |
--- a/engine/tabsqlitedb.py | |
+++ b/engine/tabsqlitedb.py | |
@@ -1169,16 +1169,9 @@ class tabsqlitedb: | |
% {'p': phrase, 'r': self.rules}) | |
if type(phrase) != type(u''): | |
phrase = phrase.decode('UTF-8') | |
- # Shouldn’t this function try first whether the system database | |
- # already has an entry for this phrase and if yes return it | |
- # instead of constructing a new entry according to the rules? | |
- # And construct a new entry only when no entry already exists | |
- # in the system database?? | |
- if len(phrase) == 0: | |
- return u'' | |
- if len(phrase) == 1: | |
- return self.get_goucima(phrase) | |
- if not self.rules: | |
+ # len(phrase) == 1 is NOT a word, | |
+ # therefore no code should be generated. | |
+ if len(phrase) <= 1 or not self.rules: | |
return u'' | |
if len(phrase) in self.rules: | |
rule = self.rules[len(phrase)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment