diff options
author | Peng Wu <alexepico@gmail.com> | 2012-01-05 11:17:49 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2012-01-05 11:20:20 +0800 |
commit | 69a66088a60c6ae03462f8fba49383e5b4772b46 (patch) | |
tree | 2d13c08f75066ea7958c1b307d7a9185a09cd791 /scripts/genpinyintable.py | |
parent | 8af616069b4805d43dc554a33d7d4503f9a87782 (diff) | |
download | libpinyin-69a66088a60c6ae03462f8fba49383e5b4772b46.tar.gz libpinyin-69a66088a60c6ae03462f8fba49383e5b4772b46.tar.xz libpinyin-69a66088a60c6ae03462f8fba49383e5b4772b46.zip |
fixes chewing index
Diffstat (limited to 'scripts/genpinyintable.py')
-rw-r--r-- | scripts/genpinyintable.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/genpinyintable.py b/scripts/genpinyintable.py index c0f91c6..05c0419 100644 --- a/scripts/genpinyintable.py +++ b/scripts/genpinyintable.py @@ -20,6 +20,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import operator +import bopomofo from pinyintable import * from chewingkey import gen_table_index @@ -38,7 +39,7 @@ def filter_pinyin_list(): if "IS_PINYIN" in flags: pinyin_index.append((wrong, flags, correct)) if "IS_CHEWING" in flags: - bopomofo_index.append((bopomofo, flags, bopomofo)) + bopomofo_index.append((bopomofo, flags)) def sort_all(): @@ -77,8 +78,9 @@ def gen_pinyin_index(): def gen_bopomofo_index(): entries = [] - for (bopomofo_str, flags, bopomofo) in bopomofo_index: - index = [x[1] for x in content_table].index(bopomofo) + for (bopomofo_str, flags) in bopomofo_index: + pinyin_str = bopomofo.BOPOMOFO_PINYIN_MAP[bopomofo_str] + index = [x[0] for x in content_table].index(pinyin_str) entry = '{{"{0}", {1}, {2}}}'.format(bopomofo_str, flags, index) entries.append(entry) return ',\n'.join(entries) |