summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorPeng Huang <shawn.p.huang@gmail.com>2009-10-05 16:42:16 +0800
committerPeng Huang <shawn.p.huang@gmail.com>2009-10-05 16:42:16 +0800
commit746f8db61544ba27269fa33f27fdecbc3246d0cb (patch)
tree26f3c8b15339f298f9c15cbff7e2039f1ff2dad3 /scripts
parent6f7acc02db4afa26082da5a561e01299f00be7ee (diff)
downloadibus-libpinyin-746f8db61544ba27269fa33f27fdecbc3246d0cb.tar.gz
ibus-libpinyin-746f8db61544ba27269fa33f27fdecbc3246d0cb.tar.xz
ibus-libpinyin-746f8db61544ba27269fa33f27fdecbc3246d0cb.zip
Refine code
Diffstat (limited to 'scripts')
-rw-r--r--scripts/genpytable.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/scripts/genpytable.py b/scripts/genpytable.py
index b777d52..bb60cc5 100644
--- a/scripts/genpytable.py
+++ b/scripts/genpytable.py
@@ -260,7 +260,7 @@ def get_all_special():
elif p[-1] in ["e"]:
yield p, "r", p[:-1], "er"
-def get_freq_sum_2(db, p1, p2):
+def get_max_freq_2(db, p1, p2):
s1, y1 = get_sheng_yun(p1)
s2, y2 = get_sheng_yun(p2)
@@ -271,7 +271,7 @@ def get_freq_sum_2(db, p1, p2):
return r[0]
return 0
-def get_freq_sum_1(db, p1):
+def get_max_freq_1(db, p1):
s1, y1 = get_sheng_yun(p1)
sql = "select max(freq), phrase from py_phrase_0 where s0 = %d and y0 = %d"
@@ -295,11 +295,11 @@ def compaired_special():
if p3 not in pinyin_list or p4 not in pinyin_list:
continue
- a1 = get_freq_sum_2(db, p1, p2)
- a2 = get_freq_sum_2(db, p3, p4)
+ a1 = get_max_freq_2(db, p1, p2)
+ a2 = get_max_freq_2(db, p3, p4)
if a1 == a2:
- a1 = get_freq_sum_1(db, p1) + get_freq_sum_1(db, p2)
- a2 = get_freq_sum_1(db, p3) + get_freq_sum_1(db, p4)
+ a1 = get_max_freq_1(db, p1) + get_max_freq_1(db, p2)
+ a2 = get_max_freq_1(db, p3) + get_max_freq_1(db, p4)
if a1 < a2:
yield p1, p2, p3, p4