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 | |
parent | ef8d3899d32fc9d8e9ba21f8dfe613636e55ca2c (diff) | |
download | libzhuyin-e862a7106a7ea1b740ec2eddecb64175ae5b8b3b.tar.gz libzhuyin-e862a7106a7ea1b740ec2eddecb64175ae5b8b3b.tar.xz libzhuyin-e862a7106a7ea1b740ec2eddecb64175ae5b8b3b.zip |
simplify full pinyin script
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/genpinyintable.py | 16 | ||||
-rw-r--r-- | scripts/pinyintable.py | 4 |
2 files changed, 10 insertions, 10 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) diff --git a/scripts/pinyintable.py b/scripts/pinyintable.py index 4e643d2..4692bc5 100644 --- a/scripts/pinyintable.py +++ b/scripts/pinyintable.py @@ -105,7 +105,7 @@ def gen_pinyins(): if chewing_key in chewing.CHEWING_ASCII_INITIAL_MAP and \ pinyin_key not in bopomofo.SPECIAL_INITIAL_SET: flags.append("CHEWING_INCOMPLETE") - yield pinyin_key, pinyin_key, chewing_key, \ + yield pinyin_key, chewing_key, \ flags, get_chewing(pinyin_key) @@ -128,7 +128,7 @@ def gen_shengmu(): chewing_initial = chewing_key[0] if chewing_initial in chewing.ASCII_CHEWING_INITIAL_MAP: chewing_initial = chewing.ASCII_CHEWING_INITIAL_MAP[chewing_initial] - yield shengmu, shengmu, chewing_initial, \ + yield shengmu, chewing_initial, \ flags, chewing_key |