diff options
author | Peng Wu <alexepico@gmail.com> | 2011-10-22 11:00:37 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2011-10-22 11:00:37 +0800 |
commit | 880a5af5dca113b480c05bfea63fccbddd03a5d2 (patch) | |
tree | 9f4fdf68b995c3a28f93b539a20312612592ab37 | |
parent | 62bdc82ef11924ac4991bf4589e0964b8a3213f3 (diff) | |
download | libpinyin-880a5af5dca113b480c05bfea63fccbddd03a5d2.tar.gz libpinyin-880a5af5dca113b480c05bfea63fccbddd03a5d2.tar.xz libpinyin-880a5af5dca113b480c05bfea63fccbddd03a5d2.zip |
update genpytable
-rw-r--r-- | scripts/genpytable.py | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/scripts/genpytable.py b/scripts/genpytable.py index d887793..31ce8ca 100644 --- a/scripts/genpytable.py +++ b/scripts/genpytable.py @@ -62,21 +62,19 @@ def get_chewing(pinyin_key): if char == "ㄜ": #merge "ㄝ" and "ㄜ" final = "CHEWING_E" - #handle "ueng"/"ong" - if middle == "CHEWING_U" and final == "CHEWING_ENG": - middle, final = "CHEWING_ZERO_MIDDLE", "PINYIN_ONG" + post_process_rules = { + #handle "ueng"/"ong" + ("CHEWING_U", "CHEWING_ENG"):("CHEWING_ZERO_MIDDLE", "PINYIN_ONG"), + #handle "veng"/"iong" + ("CHEWING_V", "CHEWING_ENG"):("CHEWING_I", "PINYIN_ONG"), + #handle "ien"/"in" + ("CHEWING_I", "CHEWING_EN"):("CHEWING_ZERO_MIDDLE", "PINYIN_IN"), + #handle "ieng"/"ing" + ("CHEWING_I", "CHEWING_ENG"):("CHEWING_ZERO_MIDDLE", "PINYIN_ING"), + } - #handle "veng"/"iong" - if middle == "CHEWING_V" and final == "CHEWING_ENG": - middle, final = "CHEWING_I", "PINYIN_ONG" - - #handle "ien"/"in" - if middle == "CHEWING_I" and final == "CHEWING_EN": - middle, final = "CHEWING_ZERO_MIDDLE", "PINYIN_IN" - - #handle "ieng"/"ing" - if middle == "CHEWING_I" and final == "CHEWING_ENG": - middle, final = "CHEWING_ZERO_MIDDLE", "PINYIN_ING" + if (middle, final) in post_process_rules: + (middle, final) = post_process_rules[(middle, final)] return initial, middle, final |