diff options
author | Peng Wu <alexepico@gmail.com> | 2013-08-12 15:08:22 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2013-08-12 15:08:22 +0800 |
commit | e862a7106a7ea1b740ec2eddecb64175ae5b8b3b (patch) | |
tree | 6f709e78fdb2ef25d420dd1ae28a8609a3ed8cbe /scripts/genpinyintable.py | |
parent | ef8d3899d32fc9d8e9ba21f8dfe613636e55ca2c (diff) | |
download | libzhuyin-e862a7106a7ea1b740ec2eddecb64175ae5b8b3b.tar.gz libzhuyin-e862a7106a7ea1b740ec2eddecb64175ae5b8b3b.tar.xz libzhuyin-e862a7106a7ea1b740ec2eddecb64175ae5b8b3b.zip |
simplify full pinyin script
Diffstat (limited to 'scripts/genpinyintable.py')
-rw-r--r-- | scripts/genpinyintable.py | 16 |
1 files changed, 8 insertions, 8 deletions
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) |