summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/genspecialtable.py12
-rw-r--r--scripts/pinyintable.py4
2 files changed, 7 insertions, 9 deletions
diff --git a/scripts/genspecialtable.py b/scripts/genspecialtable.py
index 9ea45f2..29ecd3f 100644
--- a/scripts/genspecialtable.py
+++ b/scripts/genspecialtable.py
@@ -52,9 +52,8 @@ def get_chewing_string(pinyin):
def gen_divided_table():
entries = []
for (pinyin_key, first_key, second_key, freq) in divided_list:
- pinyin_key = get_chewing_string(pinyin_key)
- first_key = get_chewing_string(first_key)
- second_key = get_chewing_string(second_key)
+ (pinyin_key, first_key, second_key) = map \
+ (get_chewing_string, (pinyin_key, first_key, second_key))
entry = '{{{0}, {1}, {2}, {3}}}'.format \
(pinyin_key, first_key, second_key, freq)
entries.append(entry)
@@ -65,10 +64,9 @@ def gen_resplit_table():
entries = []
for (orig_first_key, orig_second_key, orig_freq, \
new_first_key, new_second_key, new_freq) in resplit_list:
- orig_first_key = get_chewing_string(orig_first_key)
- orig_second_key = get_chewing_string(orig_second_key)
- new_first_key = get_chewing_string(new_first_key)
- new_second_key = get_chewing_string(new_second_key)
+ (orig_first_key, orig_second_key, new_first_key, new_second_key) = map\
+ (get_chewing_string, (orig_first_key, orig_second_key, \
+ new_first_key, new_second_key))
entry = '{{{0}, {1}, {2}, {3}, {4}, {5}}}'.format \
(orig_first_key, orig_second_key, orig_freq, \
new_first_key, new_second_key, new_freq)
diff --git a/scripts/pinyintable.py b/scripts/pinyintable.py
index 979f9b7..94fef20 100644
--- a/scripts/pinyintable.py
+++ b/scripts/pinyintable.py
@@ -27,7 +27,7 @@ from correct import *
pinyin_list = sorted(bopomofo.PINYIN_BOPOMOFO_MAP.keys())
-shengmu_list = sorted(pinyin.SHENGMU_DICT.keys())
+shengmu_list = sorted(pinyin.SHENGMU_LIST)
def check_pinyin_chewing_map():
@@ -128,7 +128,7 @@ def gen_shengmu():
chewing_key = get_shengmu_chewing(shengmu)
chewing_initial = chewing_key[0]
if chewing_initial in chewing.ASCII_CHEWING_INITIAL_MAP:
- chewing_key = chewing.ASCII_CHEWING_INITIAL_MAP[chewing_key]
+ chewing_initial = chewing.ASCII_CHEWING_INITIAL_MAP[chewing_initial]
yield shengmu, shengmu, chewing_initial, \
flags, chewing_key