From e862a7106a7ea1b740ec2eddecb64175ae5b8b3b Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Mon, 12 Aug 2013 15:08:22 +0800 Subject: simplify full pinyin script --- scripts/genpinyintable.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'scripts/genpinyintable.py') diff --git a/scripts/genpinyintable.py b/scripts/genpinyintable.py index 91ae565..262ea28 100644 --- a/scripts/genpinyintable.py +++ b/scripts/genpinyintable.py @@ -31,13 +31,13 @@ bopomofo_index = [] #pinyin table def filter_pinyin_list(): - for (correct, wrong, bopomofo, flags, chewing) in gen_pinyin_list(): + for (pinyin, bopomofo, flags, chewing) in gen_pinyin_list(): flags = '|'.join(flags) chewing = "ChewingKey({0})".format(', '.join(chewing)) #correct = correct.replace("v", "ΓΌ") - content_table.append((correct, bopomofo, chewing)) + content_table.append((pinyin, bopomofo, chewing)) if "IS_PINYIN" in flags: - pinyin_index.append((wrong, flags, correct)) + pinyin_index.append((pinyin, flags)) if "IS_CHEWING" in flags: bopomofo_index.append((bopomofo, flags)) @@ -75,17 +75,17 @@ def get_sheng_yun(pinyin): def gen_content_table(): entries = [] - for ((correct, bopomofo, chewing)) in content_table: - entry = '{{"{0}", "{1}", {2}}}'.format(correct, bopomofo, chewing) + for ((pinyin, bopomofo, chewing)) in content_table: + entry = '{{"{0}", "{1}", {2}}}'.format(pinyin, bopomofo, chewing) entries.append(entry) return ',\n'.join(entries) def gen_pinyin_index(): entries = [] - for (wrong, flags, correct) in pinyin_index: - index = [x[0] for x in content_table].index(correct) - entry = '{{"{0}", {1}, {2}}}'.format(wrong, flags, index) + for (pinyin, flags) in pinyin_index: + index = [x[0] for x in content_table].index(pinyin) + entry = '{{"{0}", {1}, {2}}}'.format(pinyin, flags, index) entries.append(entry) return ',\n'.join(entries) -- cgit