From df20383358485ac69158b6dd4bec1a3c2e5bf9ea Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Fri, 21 Oct 2011 17:35:25 +0800 Subject: improves get chewing --- scripts/genpytable.py | 12 +++++++++++- src/storage/chewing_key.h | 6 ++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/scripts/genpytable.py b/scripts/genpytable.py index ed2686f..dff65dd 100644 --- a/scripts/genpytable.py +++ b/scripts/genpytable.py @@ -59,11 +59,21 @@ def get_chewing(pinyin_key): middle = chewing.CHEWING_ASCII_MIDDLE_MAP[char] if char in chewing.CHEWING_ASCII_FINAL_MAP: final = chewing.CHEWING_ASCII_FINAL_MAP[char] - if char == "ㄜ": + 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" + + #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" + return initial, middle, final diff --git a/src/storage/chewing_key.h b/src/storage/chewing_key.h index 3e5c4b9..a9dde9a 100644 --- a/src/storage/chewing_key.h +++ b/src/storage/chewing_key.h @@ -96,7 +96,9 @@ enum ChewingFinal CHEWING_O = 13, /* "ㄛ". */ PINYIN_ONG = 14, /* "ueng". */ CHEWING_OU = 15, /* "ㄡ". */ - CHEWING_LAST_FINAL = CHEWING_OU, + PINYIN_IN = 16, /* "ien". */ + PINYIN_ING = 17, /* "ieng". */ + CHEWING_LAST_FINAL = CHEWING_ING, CHEWING_NUMBER_OF_FINALS = CHEWING_LAST_FINAL + 1 }; @@ -120,7 +122,7 @@ struct ChewingKey { guint16 m_initial : 5; guint16 m_middle : 2; - guint16 m_final : 4; + guint16 m_final : 5; guint16 m_tone : 3; }; -- cgit