diff options
author | Peng Wu <alexepico@gmail.com> | 2012-03-29 14:16:23 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2012-03-29 14:16:23 +0800 |
commit | a9ecf6dd0d492243dc4a38792411e5fa7c79f40b (patch) | |
tree | f76640900d6f72d87ad678d6ca3a09669262f84a /scripts | |
parent | a882d662f3b0a6c60234e87f7eaa78b11606caeb (diff) | |
download | libpinyin-a9ecf6dd0d492243dc4a38792411e5fa7c79f40b.tar.gz libpinyin-a9ecf6dd0d492243dc4a38792411e5fa7c79f40b.tar.xz libpinyin-a9ecf6dd0d492243dc4a38792411e5fa7c79f40b.zip |
update special table
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/genspecialtable.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/scripts/genspecialtable.py b/scripts/genspecialtable.py index df0c30f..a835bff 100644 --- a/scripts/genspecialtable.py +++ b/scripts/genspecialtable.py @@ -37,6 +37,7 @@ def sort_all(): divided_list = sorted(divided_list, key=operator.itemgetter(0)) resplit_list = sorted(resplit_list, key=operator.itemgetter(0, 1)) +''' def get_chewing_string(pinyin): #handle shengmu if pinyin not in pinyin_list: @@ -48,19 +49,17 @@ def get_chewing_string(pinyin): chewing_key = get_chewing(pinyin) chewing_str = 'ChewingKey({0})'.format(', '.join(chewing_key)) return chewing_str - +''' def gen_divided_table(): entries = [] for (pinyin_key, orig_freq, first_key, second_key, new_freq) \ in divided_list: - (pinyin_key, first_key, second_key) = map \ - (get_chewing_string, (pinyin_key, first_key, second_key)) if orig_freq >= new_freq: assert orig_freq > 0, "Expected orig_freq > 0 here." - entry = '{{{0}, {1}, {{{2}, {3}}}, {4}}}'.format \ + entry = '{{"{0}", {1}, {{"{2}", "{3}"}}, {4}}}'.format \ (pinyin_key, orig_freq, first_key, second_key, new_freq) entries.append(entry) return ',\n'.join(entries) @@ -70,13 +69,11 @@ 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, 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)) + if orig_freq >= new_freq: assert orig_freq > 0, "Expected orig_freq > 0 here." - entry = '{{{{{0}, {1}}}, {2}, {{{3}, {4}}}, {5}}}'.format \ + entry = '{{{{"{0}", "{1}"}}, {2}, {{"{3}", "{4}"}}, {5}}}'.format \ (orig_first_key, orig_second_key, orig_freq,\ new_first_key, new_second_key, new_freq) entries.append(entry) |