diff options
author | Peng Wu <alexepico@gmail.com> | 2013-08-07 14:13:15 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2013-08-07 14:13:15 +0800 |
commit | 28ac79499ac5cc7e97e9c9d20eef0edcd84d4cb0 (patch) | |
tree | 79a5d19b47d89b2cd8b5ddc267fa1e3f41b81ec4 /scripts | |
parent | 440bb43c605bfba48e14686e3f7a198381c32a88 (diff) | |
download | libzhuyin-28ac79499ac5cc7e97e9c9d20eef0edcd84d4cb0.tar.gz libzhuyin-28ac79499ac5cc7e97e9c9d20eef0edcd84d4cb0.tar.xz libzhuyin-28ac79499ac5cc7e97e9c9d20eef0edcd84d4cb0.zip |
remove double_pinyin_table.h
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.data | 1 | ||||
-rw-r--r-- | scripts/double_pinyin_table.h.in | 56 | ||||
-rw-r--r-- | scripts/gendoublepinyinheader.py | 69 | ||||
-rw-r--r-- | scripts/pinyin.py | 233 |
4 files changed, 0 insertions, 359 deletions
diff --git a/scripts/Makefile.data b/scripts/Makefile.data index 7929e97..49f65b4 100644 --- a/scripts/Makefile.data +++ b/scripts/Makefile.data @@ -7,7 +7,6 @@ pinyins.txt: update-header: python3 genpinyinheader.py > ../src/storage/pinyin_parser_table.h - python3 gendoublepinyinheader.py > ../src/storage/double_pinyin_table.h python3 genbopomofoheader.py > ../src/storage/chewing_table.h python3 genchewingkey.py > ../src/storage/chewing_enum.h diff --git a/scripts/double_pinyin_table.h.in b/scripts/double_pinyin_table.h.in deleted file mode 100644 index 15a8ee9..0000000 --- a/scripts/double_pinyin_table.h.in +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef DOUBLE_PINYIN_TABLE_H -#define DOUBLE_PINYIN_TABLE_H - -namespace pinyin{ - -const double_pinyin_scheme_shengmu_item_t double_pinyin_mspy_sheng[] = { -@MSPY_SHENG@ -}; - -const double_pinyin_scheme_yunmu_item_t double_pinyin_mspy_yun[] = { -@MSPY_YUN@ -}; - -const double_pinyin_scheme_shengmu_item_t double_pinyin_zrm_sheng[] = { -@ZRM_SHENG@ -}; - -const double_pinyin_scheme_yunmu_item_t double_pinyin_zrm_yun[] = { -@ZRM_YUN@ -}; - -const double_pinyin_scheme_shengmu_item_t double_pinyin_abc_sheng[] = { -@ABC_SHENG@ -}; - -const double_pinyin_scheme_yunmu_item_t double_pinyin_abc_yun[] = { -@ABC_YUN@ -}; - -const double_pinyin_scheme_shengmu_item_t double_pinyin_zgpy_sheng[] = { -@ZGPY_SHENG@ -}; - -const double_pinyin_scheme_yunmu_item_t double_pinyin_zgpy_yun[] = { -@ZGPY_YUN@ -}; - -const double_pinyin_scheme_shengmu_item_t double_pinyin_pyjj_sheng[] = { -@PYJJ_SHENG@ -}; - -const double_pinyin_scheme_yunmu_item_t double_pinyin_pyjj_yun[] = { -@PYJJ_YUN@ -}; - -const double_pinyin_scheme_shengmu_item_t double_pinyin_xhe_sheng[] = { -@XHE_SHENG@ -}; - -const double_pinyin_scheme_yunmu_item_t double_pinyin_xhe_yun[] = { -@XHE_YUN@ -}; - -}; - -#endif diff --git a/scripts/gendoublepinyinheader.py b/scripts/gendoublepinyinheader.py deleted file mode 100644 index 08dd817..0000000 --- a/scripts/gendoublepinyinheader.py +++ /dev/null @@ -1,69 +0,0 @@ -# -*- coding: utf-8 -*- -# vim:set et sts=4 sw=4: -# -# libpinyin - Library to deal with pinyin. -# -# Copyright (C) 2011 Peng Wu <alexepico@gmail.com> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - -import pinyin -from utils import expand_file - -def gen_shengmu_table(scheme): - entries = [] - #select shengmu mapping - sheng = pinyin.SHUANGPIN_SCHEMAS[scheme][0] - for c in "abcdefghijklmnopqrstuvwxyz;": - sh = sheng.get(c, "NULL") - if sh != "NULL": - sh = '"{0}"'.format(sh) - entry = '{{{0: <5}}} /* {1} */'.format(sh, c.upper()) - entries.append(entry) - return ',\n'.join(entries) - - -def gen_yunmu_table(scheme): - entries = [] - #select yunmu mapping - yun = pinyin.SHUANGPIN_SCHEMAS[scheme][1] - for c in "abcdefghijklmnopqrstuvwxyz;": - y = yun.get(c, ("NULL", "NULL")) - if len(y) == 1: - y1 = y[0] - y2 = "NULL" - else: - y1, y2 = y - if y1 != "NULL": - y1 = '"{0}"'.format(y1) - if y2 != "NULL": - y2 = '"{0}"'.format(y2) - entry = '{{{{{0: <7}, {1: <7}}}}} /* {2} */'.format(y1, y2, c.upper()) - entries.append(entry) - return ',\n'.join(entries) - - -def get_table_content(tablename): - (scheme, part) = tablename.split('_', 1) - if part == "SHENG": - return gen_shengmu_table(scheme) - if part == "YUN": - return gen_yunmu_table(scheme) - - -### main function ### -if __name__ == "__main__": - expand_file("double_pinyin_table.h.in", get_table_content) diff --git a/scripts/pinyin.py b/scripts/pinyin.py index dd0e156..4ed16f2 100644 --- a/scripts/pinyin.py +++ b/scripts/pinyin.py @@ -165,236 +165,3 @@ MOHU_YUNMU = { "ing" : ("in", "ing") } -MSPY_SHUANGPIN_SHENGMU_DICT = { - "b" : "b", "c" : "c", "d" : "d", "f" : "f", "g" : "g", - "h" : "h", "i" : "ch","j" : "j", "k" : "k", "l" : "l", - "m" : "m", "n" : "n", "o" : "'", "p" : "p", "q" : "q", - "r" : "r", "s" : "s", "t" : "t", "u" : "sh","v" : "zh", - "w" : "w", "x" : "x", "y" : "y", "z" : "z" -} - -MSPY_SHUANGPIN_YUNMU_DICT = { - "a" : ("a",), - "b" : ("ou",), - "c" : ("iao",), - "d" : ("uang", "iang"), - "e" : ("e",), - "f" : ("en",), - "g" : ("eng", "ng"), - "h" : ("ang",), - "i" : ("i",), - "j" : ("an",), - "k" : ("ao",), - "l" : ("ai",), - "m" : ("ian",), - "n" : ("in",), - "o" : ("uo", "o"), - "p" : ("un",), - "q" : ("iu",), - "r" : ("uan", "er"), - "s" : ("ong", "iong"), - "t" : ("ue",), - "u" : ("u",), - "v" : ("ui","ue"), - "w" : ("ia","ua"), - "x" : ("ie",), - "y" : ("uai", "v"), - "z" : ("ei",), - ";" : ("ing",) -} - -ZRM_SHUANGPIN_SHENGMU_DICT = { - "b" : "b", "c" : "c", "d" : "d", "f" : "f", "g" : "g", - "h" : "h", "i" : "ch","j" : "j", "k" : "k", "l" : "l", - "m" : "m", "n" : "n", "o" : "'", "p" : "p", "q" : "q", - "r" : "r", "s" : "s", "t" : "t", "u" : "sh","v" : "zh", - "w" : "w", "x" : "x", "y" : "y", "z" : "z" -} - -ZRM_SHUANGPIN_YUNMU_DICT = { - "a" : ("a",), - "b" : ("ou",), - "c" : ("iao",), - "d" : ("uang", "iang"), - "e" : ("e",), - "f" : ("en",), - "g" : ("eng", "ng"), - "h" : ("ang",), - "i" : ("i",), - "j" : ("an",), - "k" : ("ao",), - "l" : ("ai",), - "m" : ("ian",), - "n" : ("in",), - "o" : ("uo", "o"), - "p" : ("un",), - "q" : ("iu",), - "r" : ("uan", "er"), - "s" : ("ong", "iong"), - "t" : ("ue",), - "u" : ("u",), - "v" : ("ui","v"), - "w" : ("ia","ua"), - "x" : ("ie",), - "y" : ("uai", "ing"), - "z" : ("ei",), -} - -ABC_SHUANGPIN_SHENGMU_DICT = { - "a" : "zh", "b" : "b", "c" : "c", "d" : "d", "e":"ch", "f" : "f", "g" : "g", - "h" : "h", "j" : "j", "k" : "k", "l" : "l", - "m" : "m", "n" : "n", "o" : "'", "p" : "p", "q" : "q", - "r" : "r", "s" : "s", "t" : "t", "v" : "sh", - "w" : "w", "x" : "x", "y" : "y", "z" : "z" -} - -ABC_SHUANGPIN_YUNMU_DICT = { - "a" : ("a",), - "b" : ("ou",), - "c" : ("in","uai"), - "d" : ("ia", "ua"), - "e" : ("e",), - "f" : ("en",), - "g" : ("eng", "ng"), - "h" : ("ang",), - "i" : ("i",), - "j" : ("an",), - "k" : ("ao",), - "l" : ("ai",), - "m" : ("ue","ui"), - "n" : ("un",), - "o" : ("uo", "o"), - "p" : ("uan",), - "q" : ("ei",), - "r" : ("er", "iu"), - "s" : ("ong", "iong"), - "t" : ("iang","uang"), - "u" : ("u",), - "v" : ("v","ue"), - "w" : ("ian",), - "x" : ("ie",), - "y" : ("ing",), - "z" : ("iao",), -} - -ZGPY_SHUANGPIN_SHENGMU_DICT = { - "a" : "ch", "b" : "b", "c" : "c", "d" : "d", "f" : "f", "g" : "g", - "h" : "h", "i" : "sh","j" : "j", "k" : "k", "l" : "l", - "m" : "m", "n" : "n", "o" : "'", "p" : "p", "q" : "q", - "r" : "r", "s" : "s", "t" : "t", "u" : "zh", - "w" : "w", "x" : "x", "y" : "y", "z" : "z" -} - -ZGPY_SHUANGPIN_YUNMU_DICT = { - "a" : ("a", ), - "b" : ("iao", ), - "d" : ("ie", ), - "e" : ("e", ), - "f" : ("ian", ), - "g" : ("iang", "uang"), - "h" : ("ong", "iong"), - "i" : ("i", ), - "j" : ("er", "iu"), - "k" : ("ei", ), - "l" : ("uan", ), - "m" : ("un", ), - "n" : ("ue", "ui"), - "o" : ("uo", "o"), - "p" : ("ai", ), - "q" : ("ao", ), - "r" : ("an", ), - "s" : ("ang", ), - "t" : ("eng", "ng"), - "u" : ("u", ), - "v" : ("v", ), - "w" : ("en", ), - "x" : ("ia", "ua"), - "y" : ("in", "uai"), - "z" : ("ou" ,), - ";" : ("ing", ) -} - -PYJJ_SHUANGPIN_SHENGMU_DICT = { - "a" : "'", "b" : "b", "c" : "c", "d" : "d", "f" : "f", "g" : "g", - "h" : "h", "i" : "sh","j" : "j", "k" : "k", "l" : "l", - "m" : "m", "n" : "n", "o" : "'", "p" : "p", "q" : "q", - "r" : "r", "s" : "s", "t" : "t", "u" : "ch","v" : "zh", - "w" : "w", "x" : "x", "y" : "y", "z" : "z" -} - -PYJJ_SHUANGPIN_YUNMU_DICT = { - "a" : ("a",), - "b" : ("ia","ua"), - "c" : ("uan",), - "d" : ("ao", ), - "e" : ("e",), - "f" : ("an",), - "g" : ("ang",), - "h" : ("iang","uang"), - "i" : ("i",), - "j" : ("ian",), - "k" : ("iao",), - "l" : ("in",), - "m" : ("ie",), - "n" : ("iu",), - "o" : ("uo", "o"), - "p" : ("ou",), - "q" : ("er","ing"), - "r" : ("en", ), - "s" : ("ai", ), - "t" : ("eng", "ng"), - "u" : ("u",), - "v" : ("v","ui"), - "w" : ("ei",), - "x" : ("uai","ue"), - "y" : ("ong","iong"), - "z" : ("un",), -} - -XHE_SHUANGPIN_SHENGMU_DICT = { - "b" : "b", "c" : "c", "d" : "d", "f" : "f", "g" : "g", - "h" : "h", "i" : "ch", "j" : "j", "k" : "k", "l" : "l", - "m" : "m", "n" : "n", "o" : "'", "p" : "p", "q" : "q", - "r" : "r", "s" : "s", "t" : "t", "u" : "sh", "v" : "zh", - "w" : "w", "x" : "x", "y" : "y", "z" : "z", - "a" : "'", "e" : "'" -} - -XHE_SHUANGPIN_YUNMU_DICT = { - "a" : ("a",), - "b" : ("in",), - "c" : ("ao",), - "d" : ("ai",), - "e" : ("e",), - "f" : ("en",), - "g" : ("eng", "ng"), - "h" : ("ang",), - "i" : ("i",), - "j" : ("an",), - "k" : ("uai", "ing"), - "l" : ("iang", "uang"), - "m" : ("ian",), - "n" : ("iao",), - "o" : ("uo", "o"), - "p" : ("ie",), - "q" : ("iu",), - "r" : ("uan", "er"), - "s" : ("ong", "iong"), - "t" : ("ue",), - "u" : ("u",), - "v" : ("v", "ui"), - "w" : ("ei",), - "x" : ("ia", "ua"), - "y" : ("un",), - "z" : ("ou",), -} - -SHUANGPIN_SCHEMAS = { - N_("MSPY") : (MSPY_SHUANGPIN_SHENGMU_DICT, MSPY_SHUANGPIN_YUNMU_DICT), - N_("ZRM") : (ZRM_SHUANGPIN_SHENGMU_DICT, ZRM_SHUANGPIN_YUNMU_DICT), - N_("ABC") : (ABC_SHUANGPIN_SHENGMU_DICT, ABC_SHUANGPIN_YUNMU_DICT), - N_("ZGPY") : (ZGPY_SHUANGPIN_SHENGMU_DICT, ZGPY_SHUANGPIN_YUNMU_DICT), - N_("PYJJ") : (PYJJ_SHUANGPIN_SHENGMU_DICT, PYJJ_SHUANGPIN_YUNMU_DICT), - N_("XHE") : (XHE_SHUANGPIN_SHENGMU_DICT, XHE_SHUANGPIN_YUNMU_DICT), -} - |