From 86771016e43aab669a3866ccbad4962689633194 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Sat, 22 Oct 2011 10:15:27 +0800 Subject: begin to write chewing key --- scripts/genpytable.py | 6 +++++- src/pinyin.h | 2 ++ src/storage/Makefile.am | 4 +++- src/storage/chewing_custom.h | 0 src/storage/chewing_key.h | 2 +- 5 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 src/storage/chewing_custom.h diff --git a/scripts/genpytable.py b/scripts/genpytable.py index dff65dd..d887793 100644 --- a/scripts/genpytable.py +++ b/scripts/genpytable.py @@ -66,6 +66,10 @@ def get_chewing(pinyin_key): if middle == "CHEWING_U" and final == "CHEWING_ENG": middle, final = "CHEWING_ZERO_MIDDLE", "PINYIN_ONG" + #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" @@ -82,5 +86,5 @@ if __name__ == "__main__": #pre-check here check_pinyin_chewing_map() #dump - for pinyin_key in pinyin.PINYIN_DICT.keys(): + for pinyin_key in sorted(pinyin.PINYIN_DICT.keys()): print (pinyin_key, get_chewing(pinyin_key)) diff --git a/src/pinyin.h b/src/pinyin.h index 5820532..ec5b141 100644 --- a/src/pinyin.h +++ b/src/pinyin.h @@ -27,6 +27,8 @@ #include "novel_types.h" #include "pinyin_custom.h" #include "pinyin_base.h" +#include "chewing_key.h" +#include "chewing_custom.h" using namespace pinyin; diff --git a/src/storage/Makefile.am b/src/storage/Makefile.am index 60bc4a0..5ea8c19 100644 --- a/src/storage/Makefile.am +++ b/src/storage/Makefile.am @@ -22,7 +22,9 @@ INCLUDES = -I$(top_srcdir)/src/include \ libpinyinincludedir = $(includedir)/libpinyin-@LIBPINYIN_BINARY_VERSION@ libpinyininclude_HEADERS= pinyin_custom.h \ - pinyin_base.h + pinyin_base.h \ + chewing_key.h \ + chewing_custom.h noinst_HEADERS = pinyin_large_table.h \ pinyin_phrase.h \ diff --git a/src/storage/chewing_custom.h b/src/storage/chewing_custom.h new file mode 100644 index 0000000..e69de29 diff --git a/src/storage/chewing_key.h b/src/storage/chewing_key.h index a9dde9a..f42c66c 100644 --- a/src/storage/chewing_key.h +++ b/src/storage/chewing_key.h @@ -98,7 +98,7 @@ enum ChewingFinal CHEWING_OU = 15, /* "ㄡ". */ PINYIN_IN = 16, /* "ien". */ PINYIN_ING = 17, /* "ieng". */ - CHEWING_LAST_FINAL = CHEWING_ING, + CHEWING_LAST_FINAL = PINYIN_ING, CHEWING_NUMBER_OF_FINALS = CHEWING_LAST_FINAL + 1 }; -- cgit