summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.data7
-rw-r--r--scripts/bopomofo.py1353
-rw-r--r--scripts/bopomofokeyboard.py105
-rw-r--r--scripts/chewing.py73
-rw-r--r--scripts/chewing_enum.h.in45
-rw-r--r--scripts/chewing_table.h.in121
-rw-r--r--scripts/chewingkey.py150
-rw-r--r--scripts/correct.py129
-rw-r--r--scripts/genbopomofoheader.py119
-rw-r--r--scripts/genchewingkey.py41
-rw-r--r--scripts/genpinyinheader.py55
-rw-r--r--scripts/genpinyintable.py270
-rw-r--r--scripts/pinyin.py167
-rw-r--r--scripts/pinyin_parser_table.h.in52
-rw-r--r--scripts/pinyintable.py143
-rw-r--r--scripts/utils.py65
16 files changed, 0 insertions, 2895 deletions
diff --git a/scripts/Makefile.data b/scripts/Makefile.data
deleted file mode 100644
index 624db75..0000000
--- a/scripts/Makefile.data
+++ /dev/null
@@ -1,7 +0,0 @@
-all:
-
-
-update-header:
- python3 genpinyinheader.py > ../src/storage/pinyin_parser_table.h
- python3 genbopomofoheader.py > ../src/storage/chewing_table.h
- python3 genchewingkey.py > ../src/storage/chewing_enum.h
diff --git a/scripts/bopomofo.py b/scripts/bopomofo.py
deleted file mode 100644
index 349f494..0000000
--- a/scripts/bopomofo.py
+++ /dev/null
@@ -1,1353 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim:set et sts=4 sw=4:
-#
-# libzhuyin - Library to deal with zhuyin.
-#
-# Copyright (c) 2010 BYVoid <byvoid1@gmail.com>
-# 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.
-
-
-BOPOMOFO_HANYU_PINYIN_MAP = {
- "ㄅ" : "b",
- "ㄅㄚ" : "ba",
- "ㄅㄛ" : "bo",
- "ㄅㄞ" : "bai",
- "ㄅㄟ" : "bei",
- "ㄅㄠ" : "bao",
- "ㄅㄢ" : "ban",
- "ㄅㄣ" : "ben",
- "ㄅㄤ" : "bang",
- "ㄅㄥ" : "beng",
- "ㄅㄧ" : "bi",
- "ㄅㄧㄝ" : "bie",
- "ㄅㄧㄠ" : "biao",
- "ㄅㄧㄢ" : "bian",
- "ㄅㄧㄣ" : "bin",
- "ㄅㄧㄥ" : "bing",
- "ㄅㄨ" : "bu",
- "ㄆ" : "p",
- "ㄆㄚ" : "pa",
- "ㄆㄛ" : "po",
- "ㄆㄞ" : "pai",
- "ㄆㄟ" : "pei",
- "ㄆㄠ" : "pao",
- "ㄆㄡ" : "pou",
- "ㄆㄢ" : "pan",
- "ㄆㄣ" : "pen",
- "ㄆㄤ" : "pang",
- "ㄆㄥ" : "peng",
- "ㄆㄧ" : "pi",
- "ㄆㄧㄝ" : "pie",
- "ㄆㄧㄠ" : "piao",
- "ㄆㄧㄢ" : "pian",
- "ㄆㄧㄣ" : "pin",
- "ㄆㄧㄥ" : "ping",
- "ㄆㄨ" : "pu",
- "ㄇ" : "m",
- "ㄇㄚ" : "ma",
- "ㄇㄛ" : "mo",
- "ㄇㄜ" : "me",
- "ㄇㄞ" : "mai",
- "ㄇㄟ" : "mei",
- "ㄇㄠ" : "mao",
- "ㄇㄡ" : "mou",
- "ㄇㄢ" : "man",
- "ㄇㄣ" : "men",
- "ㄇㄤ" : "mang",
- "ㄇㄥ" : "meng",
- "ㄇㄧ" : "mi",
- "ㄇㄧㄝ" : "mie",
- "ㄇㄧㄠ" : "miao",
- "ㄇㄧㄡ" : "miu",
- "ㄇㄧㄢ" : "mian",
- "ㄇㄧㄣ" : "min",
- "ㄇㄧㄥ" : "ming",
- "ㄇㄨ" : "mu",
- "ㄈ" : "f",
- "ㄈㄚ" : "fa",
- "ㄈㄛ" : "fo",
- "ㄈㄜ" : "fe",
- "ㄈㄟ" : "fei",
- "ㄈㄡ" : "fou",
- "ㄈㄢ" : "fan",
- "ㄈㄣ" : "fen",
- "ㄈㄤ" : "fang",
- "ㄈㄥ" : "feng",
- "ㄈㄨ" : "fu",
- "ㄉ" : "d",
- "ㄉㄚ" : "da",
- "ㄉㄜ" : "de",
- "ㄉㄞ" : "dai",
- "ㄉㄟ" : "dei",
- "ㄉㄠ" : "dao",
- "ㄉㄡ" : "dou",
- "ㄉㄢ" : "dan",
- "ㄉㄣ" : "den",
- "ㄉㄤ" : "dang",
- "ㄉㄥ" : "deng",
- "ㄉㄧ" : "di",
- "ㄉㄧㄚ" : "dia",
- "ㄉㄧㄝ" : "die",
- "ㄉㄧㄠ" : "diao",
- "ㄉㄧㄡ" : "diu",
- "ㄉㄧㄢ" : "dian",
- "ㄉㄧㄣ" : "din",
- "ㄉㄧㄥ" : "ding",
- "ㄉㄨ" : "du",
- "ㄉㄨㄛ" : "duo",
- "ㄉㄨㄟ" : "dui",
- "ㄉㄨㄢ" : "duan",
- "ㄉㄨㄣ" : "dun",
- "ㄉㄨㄥ" : "dong",
- "ㄊ" : "t",
- "ㄊㄚ" : "ta",
- "ㄊㄜ" : "te",
- "ㄊㄞ" : "tai",
- "ㄊㄠ" : "tao",
- "ㄊㄡ" : "tou",
- "ㄊㄢ" : "tan",
- "ㄊㄤ" : "tang",
- "ㄊㄥ" : "teng",
- "ㄊㄧ" : "ti",
- "ㄊㄧㄝ" : "tie",
- "ㄊㄧㄠ" : "tiao",
- "ㄊㄧㄢ" : "tian",
- "ㄊㄧㄥ" : "ting",
- "ㄊㄨ" : "tu",
- "ㄊㄨㄛ" : "tuo",
- "ㄊㄨㄟ" : "tui",
- "ㄊㄨㄢ" : "tuan",
- "ㄊㄨㄣ" : "tun",
- "ㄊㄨㄥ" : "tong",
- "ㄋ" : "n",
- "ㄋㄚ" : "na",
- "ㄋㄜ" : "ne",
- "ㄋㄞ" : "nai",
- "ㄋㄟ" : "nei",
- "ㄋㄠ" : "nao",
- "ㄋㄡ" : "nou",
- "ㄋㄢ" : "nan",
- "ㄋㄣ" : "nen",
- "ㄋㄤ" : "nang",
- "ㄋㄥ" : "neng",
- "ㄋㄧ" : "ni",
- "ㄋㄧㄚ" : "nia",
- "ㄋㄧㄝ" : "nie",
- "ㄋㄧㄠ" : "niao",
- "ㄋㄧㄡ" : "niu",
- "ㄋㄧㄢ" : "nian",
- "ㄋㄧㄣ" : "nin",
- "ㄋㄧㄤ" : "niang",
- "ㄋㄧㄥ" : "ning",
- "ㄋㄨ" : "nu",
- "ㄋㄨㄛ" : "nuo",
- "ㄋㄨㄢ" : "nuan",
- "ㄋㄨㄣ" : "nun",
- "ㄋㄨㄥ" : "nong",
- "ㄋㄩ" : "nv",
- "ㄋㄩㄝ" : "nve",
- "ㄌ" : "l",
- "ㄌㄚ" : "la",
- "ㄌㄛ" : "lo",
- "ㄌㄜ" : "le",
- "ㄌㄞ" : "lai",
- "ㄌㄟ" : "lei",
- "ㄌㄠ" : "lao",
- "ㄌㄡ" : "lou",
- "ㄌㄢ" : "lan",
- "ㄌㄣ" : "len",
- "ㄌㄤ" : "lang",
- "ㄌㄥ" : "leng",
- "ㄌㄧ" : "li",
- "ㄌㄧㄚ" : "lia",
- "ㄌㄧㄝ" : "lie",
- "ㄌㄧㄠ" : "liao",
- "ㄌㄧㄡ" : "liu",
- "ㄌㄧㄢ" : "lian",
- "ㄌㄧㄣ" : "lin",
- "ㄌㄧㄤ" : "liang",
- "ㄌㄧㄥ" : "ling",
- "ㄌㄨ" : "lu",
- "ㄌㄨㄛ" : "luo",
- "ㄌㄨㄢ" : "luan",
- "ㄌㄨㄣ" : "lun",
- "ㄌㄨㄥ" : "long",
- "ㄌㄩ" : "lv",
- "ㄌㄩㄝ" : "lve",
- "ㄍ" : "g",
- "ㄍㄚ" : "ga",
- "ㄍㄜ" : "ge",
- "ㄍㄞ" : "gai",
- "ㄍㄟ" : "gei",
- "ㄍㄠ" : "gao",
- "ㄍㄡ" : "gou",
- "ㄍㄢ" : "gan",
- "ㄍㄣ" : "gen",
- "ㄍㄤ" : "gang",
- "ㄍㄥ" : "geng",
- "ㄍㄨ" : "gu",
- "ㄍㄨㄚ" : "gua",
- "ㄍㄨㄛ" : "guo",
- "ㄍㄨㄞ" : "guai",
- "ㄍㄨㄟ" : "gui",
- "ㄍㄨㄢ" : "guan",
- "ㄍㄨㄣ" : "gun",
- "ㄍㄨㄤ" : "guang",
- "ㄍㄨㄥ" : "gong",
- "ㄎ" : "k",
- "ㄎㄚ" : "ka",
- "ㄎㄜ" : "ke",
- "ㄎㄞ" : "kai",
- "ㄎㄟ" : "kei",
- "ㄎㄠ" : "kao",
- "ㄎㄡ" : "kou",
- "ㄎㄢ" : "kan",
- "ㄎㄣ" : "ken",
- "ㄎㄤ" : "kang",
- "ㄎㄥ" : "keng",
- "ㄎㄨ" : "ku",
- "ㄎㄨㄚ" : "kua",
- "ㄎㄨㄛ" : "kuo",
- "ㄎㄨㄞ" : "kuai",
- "ㄎㄨㄟ" : "kui",
- "ㄎㄨㄢ" : "kuan",
- "ㄎㄨㄣ" : "kun",
- "ㄎㄨㄤ" : "kuang",
- "ㄎㄨㄥ" : "kong",
- "ㄏ" : "h",
- "ㄏㄚ" : "ha",
- "ㄏㄜ" : "he",
- "ㄏㄞ" : "hai",
- "ㄏㄟ" : "hei",
- "ㄏㄠ" : "hao",
- "ㄏㄡ" : "hou",
- "ㄏㄢ" : "han",
- "ㄏㄣ" : "hen",
- "ㄏㄤ" : "hang",
- "ㄏㄥ" : "heng",
- "ㄏㄨ" : "hu",
- "ㄏㄨㄚ" : "hua",
- "ㄏㄨㄛ" : "huo",
- "ㄏㄨㄞ" : "huai",
- "ㄏㄨㄟ" : "hui",
- "ㄏㄨㄢ" : "huan",
- "ㄏㄨㄣ" : "hun",
- "ㄏㄨㄤ" : "huang",
- "ㄏㄨㄥ" : "hong",
- "ㄐ" : "j",
- "ㄐㄧ" : "ji",
- "ㄐㄧㄚ" : "jia",
- "ㄐㄧㄝ" : "jie",
- "ㄐㄧㄠ" : "jiao",
- "ㄐㄧㄡ" : "jiu",
- "ㄐㄧㄢ" : "jian",
- "ㄐㄧㄣ" : "jin",
- "ㄐㄧㄤ" : "jiang",
- "ㄐㄧㄥ" : "jing",
- "ㄐㄩ" : "ju",
- "ㄐㄩㄝ" : "jue",
- "ㄐㄩㄢ" : "juan",
- "ㄐㄩㄣ" : "jun",
- "ㄐㄩㄥ" : "jiong",
- "ㄑ" : "q",
- "ㄑㄧ" : "qi",
- "ㄑㄧㄚ" : "qia",
- "ㄑㄧㄝ" : "qie",
- "ㄑㄧㄠ" : "qiao",
- "ㄑㄧㄡ" : "qiu",
- "ㄑㄧㄢ" : "qian",
- "ㄑㄧㄣ" : "qin",
- "ㄑㄧㄤ" : "qiang",
- "ㄑㄧㄥ" : "qing",
- "ㄑㄩ" : "qu",
- "ㄑㄩㄝ" : "que",
- "ㄑㄩㄢ" : "quan",
- "ㄑㄩㄣ" : "qun",
- "ㄑㄩㄥ" : "qiong",
- "ㄒ" : "x",
- "ㄒㄧ" : "xi",
- "ㄒㄧㄚ" : "xia",
- "ㄒㄧㄝ" : "xie",
- "ㄒㄧㄠ" : "xiao",
- "ㄒㄧㄡ" : "xiu",
- "ㄒㄧㄢ" : "xian",
- "ㄒㄧㄣ" : "xin",
- "ㄒㄧㄤ" : "xiang",
- "ㄒㄧㄥ" : "xing",
- "ㄒㄩ" : "xu",
- "ㄒㄩㄝ" : "xue",
- "ㄒㄩㄢ" : "xuan",
- "ㄒㄩㄣ" : "xun",
- "ㄒㄩㄥ" : "xiong",
- "ㄓ" : "zhi",
- "ㄓㄚ" : "zha",
- "ㄓㄜ" : "zhe",
- "ㄓㄞ" : "zhai",
- "ㄓㄟ" : "zhei",
- "ㄓㄠ" : "zhao",
- "ㄓㄡ" : "zhou",
- "ㄓㄢ" : "zhan",
- "ㄓㄣ" : "zhen",
- "ㄓㄤ" : "zhang",
- "ㄓㄥ" : "zheng",
- "ㄓㄨ" : "zhu",
- "ㄓㄨㄚ" : "zhua",
- "ㄓㄨㄛ" : "zhuo",
- "ㄓㄨㄞ" : "zhuai",
- "ㄓㄨㄟ" : "zhui",
- "ㄓㄨㄢ" : "zhuan",
- "ㄓㄨㄣ" : "zhun",
- "ㄓㄨㄤ" : "zhuang",
- "ㄓㄨㄥ" : "zhong",
- "ㄔ" : "chi",
- "ㄔㄚ" : "cha",
- "ㄔㄜ" : "che",
- "ㄔㄞ" : "chai",
- "ㄔㄠ" : "chao",
- "ㄔㄡ" : "chou",
- "ㄔㄢ" : "chan",
- "ㄔㄣ" : "chen",
- "ㄔㄤ" : "chang",
- "ㄔㄥ" : "cheng",
- "ㄔㄨ" : "chu",
- "ㄔㄨㄚ" : "chua",
- "ㄔㄨㄛ" : "chuo",
- "ㄔㄨㄞ" : "chuai",
- "ㄔㄨㄟ" : "chui",
- "ㄔㄨㄢ" : "chuan",
- "ㄔㄨㄣ" : "chun",
- "ㄔㄨㄤ" : "chuang",
- "ㄔㄨㄥ" : "chong",
- "ㄕ" : "shi",
- "ㄕㄚ" : "sha",
- "ㄕㄜ" : "she",
- "ㄕㄞ" : "shai",
- "ㄕㄟ" : "shei",
- "ㄕㄠ" : "shao",
- "ㄕㄡ" : "shou",
- "ㄕㄢ" : "shan",
- "ㄕㄣ" : "shen",
- "ㄕㄤ" : "shang",
- "ㄕㄥ" : "sheng",
- "ㄕㄨ" : "shu",
- "ㄕㄨㄚ" : "shua",
- "ㄕㄨㄛ" : "shuo",
- "ㄕㄨㄞ" : "shuai",
- "ㄕㄨㄟ" : "shui",
- "ㄕㄨㄢ" : "shuan",
- "ㄕㄨㄣ" : "shun",
- "ㄕㄨㄤ" : "shuang",
- "ㄖ" : "ri",
- "ㄖㄜ" : "re",
- "ㄖㄠ" : "rao",
- "ㄖㄡ" : "rou",
- "ㄖㄢ" : "ran",
- "ㄖㄣ" : "ren",
- "ㄖㄤ" : "rang",
- "ㄖㄥ" : "reng",
- "ㄖㄨ" : "ru",
- "ㄖㄨㄚ" : "rua",
- "ㄖㄨㄛ" : "ruo",
- "ㄖㄨㄟ" : "rui",
- "ㄖㄨㄢ" : "ruan",
- "ㄖㄨㄣ" : "run",
- "ㄖㄨㄥ" : "rong",
- "ㄗ" : "zi",
- "ㄗㄚ" : "za",
- "ㄗㄜ" : "ze",
- "ㄗㄞ" : "zai",
- "ㄗㄟ" : "zei",
- "ㄗㄠ" : "zao",
- "ㄗㄡ" : "zou",
- "ㄗㄢ" : "zan",
- "ㄗㄣ" : "zen",
- "ㄗㄤ" : "zang",
- "ㄗㄥ" : "zeng",
- "ㄗㄨ" : "zu",
- "ㄗㄨㄛ" : "zuo",
- "ㄗㄨㄟ" : "zui",
- "ㄗㄨㄢ" : "zuan",
- "ㄗㄨㄣ" : "zun",
- "ㄗㄨㄥ" : "zong",
- "ㄘ" : "ci",
- "ㄘㄚ" : "ca",
- "ㄘㄜ" : "ce",
- "ㄘㄞ" : "cai",
- "ㄘㄠ" : "cao",
- "ㄘㄡ" : "cou",
- "ㄘㄢ" : "can",
- "ㄘㄣ" : "cen",
- "ㄘㄤ" : "cang",
- "ㄘㄥ" : "ceng",
- "ㄘㄨ" : "cu",
- "ㄘㄨㄛ" : "cuo",
- "ㄘㄨㄟ" : "cui",
- "ㄘㄨㄢ" : "cuan",
- "ㄘㄨㄣ" : "cun",
- "ㄘㄨㄥ" : "cong",
- "ㄙ" : "si",
- "ㄙㄚ" : "sa",
- "ㄙㄜ" : "se",
- "ㄙㄞ" : "sai",
- "ㄙㄠ" : "sao",
- "ㄙㄡ" : "sou",
- "ㄙㄢ" : "san",
- "ㄙㄣ" : "sen",
- "ㄙㄤ" : "sang",
- "ㄙㄥ" : "seng",
- "ㄙㄨ" : "su",
- "ㄙㄨㄛ" : "suo",
- "ㄙㄨㄟ" : "sui",
- "ㄙㄨㄢ" : "suan",
- "ㄙㄨㄣ" : "sun",
- "ㄙㄨㄥ" : "song",
- "ㄚ" : "a",
- "ㄛ" : "o",
- "ㄜ" : "e",
- "ㄞ" : "ai",
- "ㄟ" : "ei",
- "ㄠ" : "ao",
- "ㄡ" : "ou",
- "ㄢ" : "an",
- "ㄣ" : "en",
- "ㄤ" : "ang",
- "ㄥ" : "eng",
- "ㄦ" : "er",
- "ㄧ" : "yi",
- "ㄧㄚ" : "ya",
- "ㄧㄛ" : "yo",
- "ㄧㄝ" : "ye",
- "ㄧㄞ" : "yai",
- "ㄧㄠ" : "yao",
- "ㄧㄡ" : "you",
- "ㄧㄢ" : "yan",
- "ㄧㄣ" : "yin",
- "ㄧㄤ" : "yang",
- "ㄧㄥ" : "ying",
- "ㄨ" : "wu",
- "ㄨㄚ" : "wa",
- "ㄨㄛ" : "wo",
- "ㄨㄞ" : "wai",
- "ㄨㄟ" : "wei",
- "ㄨㄢ" : "wan",
- "ㄨㄣ" : "wen",
- "ㄨㄤ" : "wang",
- "ㄨㄥ" : "weng",
- "ㄩ" : "yu",
- "ㄩㄝ" : "yue",
- "ㄩㄢ" : "yuan",
- "ㄩㄣ" : "yun",
- "ㄩㄥ" : "yong",
- "ㄫ" : "ng",
-}
-
-HANYU_PINYIN_BOPOMOFO_MAP = dict([(v, k) for k, v in BOPOMOFO_HANYU_PINYIN_MAP.items()])
-
-SPECIAL_INITIAL_SET = {'ci', 'chi', 'si', 'shi', 'zi', 'zhi', 'ri'}
-
-'''
-SHENG_YUN_BOPOMOFO_MAP = {
- "b" : "ㄅ",
- "p" : "ㄆ",
- "m" : "ㄇ",
- "f" : "ㄈ",
- "d" : "ㄉ",
- "t" : "ㄊ",
- "n" : "ㄋ",
- "l" : "ㄌ",
- "g" : "ㄍ",
- "k" : "ㄎ",
- "h" : "ㄏ",
- "j" : "ㄐ",
- "q" : "ㄑ",
- "x" : "ㄒ",
- "zh" : "ㄓ",
- "ch" : "ㄔ",
- "sh" : "ㄕ",
- "r" : "ㄖ",
- "z" : "ㄗ",
- "c" : "ㄘ",
- "s" : "ㄙ",
-
- # 韻母為u,ue,un,uan,ong時ㄧ省略
- "y" : ("ㄧ", (("u", "ue", "un", "uan", "ong"), "")),
- "w" : "ㄨ",
- "a" : "ㄚ",
- "o" : "ㄛ",
- "e" : ("ㄜ", ("y", "ㄝ")), # y後面為ㄝ
-
- # zh ch sh r z c s y後面為空
- "i" : ("ㄧ", (("zh", "ch", "sh", "r", "z", "c", "s", "y"), "")),
-
- # jqxy後面為ㄩ w後面為空
- "u" : ("ㄨ", ("jqxy", "ㄩ")),
- "v" : "ㄩ",
- "ai" : "ㄞ",
- "ei" : "ㄟ",
- "ao" : "ㄠ",
- "ou" : "ㄡ",
- "an" : "ㄢ",
- "en" : "ㄣ",
- "ang" : "ㄤ",
- "eng" : "ㄥ",
- "er" : "ㄦ",
- "ia" : "ㄧㄚ",
- "ie" : "ㄧㄝ",
- "iai" : "ㄧㄞ",
- "iao" : "ㄧㄠ",
- "iu" : "ㄧㄡ",
- "ian" : "ㄧㄢ",
- "in" : ("ㄧㄣ", ("y", "ㄣ")), #y後面為ㄣ
- "iang" : "ㄧㄤ",
- "ing" : ("ㄧㄥ", ("y", "ㄥ")), #y後面為ㄥ
- "ua" : "ㄨㄚ",
- "uo" : "ㄨㄛ",
- "ue" : "ㄩㄝ",
- # TODO: "ve" is OK?
- "ve" : "ㄩㄝ",
- "uai" : "ㄨㄞ",
- "ui" : "ㄨㄟ",
- "uan" : ("ㄨㄢ", ("jqxy", "ㄩㄢ")), # jqxy後面是ㄩㄢ
- "un" : ("ㄨㄣ", ("jqxy", "ㄩㄣ")), # jqxy後面是ㄩㄣ
- "uang" : ("ㄨㄤ", ("jqxy", "ㄩㄤ")), # jqxy後面是ㄩㄤ
- "ong" : ("ㄨㄥ", ("jqxy", "ㄩㄥ")), # y後面為ㄩㄥ
- "iong" : "ㄩㄥ",
-}
-'''
-
-BOPOMOFO_LUOMA_PINYIN_MAP = {
- "ㄅㄚ" : "ba",
- "ㄅㄛ" : "bo",
- "ㄅㄞ" : "bai",
- "ㄅㄟ" : "bei",
- "ㄅㄠ" : "bao",
- "ㄅㄢ" : "ban",
- "ㄅㄣ" : "ben",
- "ㄅㄤ" : "bang",
- "ㄅㄥ" : "beng",
- "ㄅㄧ" : "bi",
- "ㄅㄧㄝ" : "bieh",
- "ㄅㄧㄠ" : "biao",
- "ㄅㄧㄢ" : "bian",
- "ㄅㄧㄣ" : "bin",
- "ㄅㄧㄥ" : "bing",
- "ㄅㄨ" : "bu",
- "ㄆㄚ" : "pa",
- "ㄆㄛ" : "po",
- "ㄆㄞ" : "pai",
- "ㄆㄟ" : "pei",
- "ㄆㄠ" : "pao",
- "ㄆㄡ" : "pou",
- "ㄆㄢ" : "pan",
- "ㄆㄣ" : "pen",
- "ㄆㄤ" : "pang",
- "ㄆㄥ" : "peng",
- "ㄆㄧ" : "pi",
- "ㄆㄧㄝ" : "pieh",
- "ㄆㄧㄠ" : "piao",
- "ㄆㄧㄢ" : "pian",
- "ㄆㄧㄣ" : "pin",
- "ㄆㄧㄥ" : "ping",
- "ㄆㄨ" : "pu",
- "ㄇㄚ" : "ma",
- "ㄇㄛ" : "mo",
- "ㄇㄜ" : "me",
- "ㄇㄞ" : "mai",
- "ㄇㄟ" : "mei",
- "ㄇㄠ" : "mao",
- "ㄇㄡ" : "mou",
- "ㄇㄢ" : "man",
- "ㄇㄣ" : "men",
- "ㄇㄤ" : "mang",
- "ㄇㄥ" : "meng",
- "ㄇㄧ" : "mi",
- "ㄇㄧㄝ" : "mieh",
- "ㄇㄧㄠ" : "miao",
- "ㄇㄧㄡ" : "miou",
- "ㄇㄧㄢ" : "mian",
- "ㄇㄧㄣ" : "min",
- "ㄇㄧㄥ" : "ming",
- "ㄇㄨ" : "mu",
- "ㄈㄚ" : "fa",
- "ㄈㄛ" : "fo",
- "ㄈㄟ" : "fei",
- "ㄈㄡ" : "fou",
- "ㄈㄢ" : "fan",
- "ㄈㄣ" : "fen",
- "ㄈㄤ" : "fang",
- "ㄈㄨ" : "fu",
- "ㄉㄚ" : "da",
- "ㄉㄜ" : "de",
- "ㄉㄞ" : "dai",
- "ㄉㄟ" : "dei",
- "ㄉㄠ" : "dao",
- "ㄉㄡ" : "dou",
- "ㄉㄢ" : "dan",
- "ㄉㄤ" : "dang",
- "ㄉㄥ" : "deng",
- "ㄉㄧ" : "di",
- "ㄉㄧㄝ" : "dieh",
- "ㄉㄧㄠ" : "diao",
- "ㄉㄧㄡ" : "diou",
- "ㄉㄧㄢ" : "dian",
- "ㄉㄧㄥ" : "ding",
- "ㄉㄨ" : "du",
- "ㄉㄨㄛ" : "duo",
- "ㄉㄨㄟ" : "duei",
- "ㄉㄨㄢ" : "duan",
- "ㄉㄨㄣ" : "dun",
- "ㄉㄨㄥ" : "dong",
- "ㄊㄚ" : "ta",
- "ㄊㄜ" : "te",
- "ㄊㄞ" : "tai",
- "ㄊㄠ" : "tao",
- "ㄊㄡ" : "tou",
- "ㄊㄢ" : "tan",
- "ㄊㄤ" : "tang",
- "ㄊㄥ" : "teng",
- "ㄊㄧ" : "ti",
- "ㄊㄧㄝ" : "tieh",
- "ㄊㄧㄠ" : "tiao",
- "ㄊㄧㄢ" : "tian",
- "ㄊㄧㄥ" : "ting",
- "ㄊㄨ" : "tu",
- "ㄊㄨㄛ" : "tuo",
- "ㄊㄨㄟ" : "tuei",
- "ㄊㄨㄢ" : "tuan",
- "ㄊㄨㄣ" : "tun",
- "ㄊㄨㄥ" : "tong",
- "ㄋㄚ" : "na",
- "ㄋㄜ" : "ne",
- "ㄋㄞ" : "nai",
- "ㄋㄟ" : "nei",
- "ㄋㄠ" : "nao",
- "ㄋㄡ" : "nou",
- "ㄋㄢ" : "nan",
- "ㄋㄣ" : "nen",
- "ㄋㄤ" : "nang",
- "ㄋㄥ" : "neng",
- "ㄋㄧ" : "ni",
- "ㄋㄧㄝ" : "nieh",
- "ㄋㄧㄠ" : "niao",
- "ㄋㄧㄡ" : "niou",
- "ㄋㄧㄢ" : "nian",
- "ㄋㄧㄣ" : "nin",
- "ㄋㄧㄤ" : "niang",
- "ㄋㄧㄥ" : "ning",
- "ㄋㄨ" : "nu",
- "ㄋㄨㄛ" : "nuo",
- "ㄋㄨㄢ" : "nuan",
- "ㄋㄨㄣ" : "nun",
- "ㄋㄨㄥ" : "nong",
- "ㄋㄩ" : "nyu",
- "ㄋㄩㄝ" : "nyueh",
- "ㄌㄚ" : "la",
- "ㄌㄛ" : "lo",
- "ㄌㄜ" : "le",
- "ㄌㄞ" : "lai",
- "ㄌㄟ" : "lei",
- "ㄌㄠ" : "lao",
- "ㄌㄡ" : "lou",
- "ㄌㄢ" : "lan",
- "ㄌㄤ" : "lang",
- "ㄌㄥ" : "leng",
- "ㄌㄧ" : "li",
- "ㄌㄧㄚ" : "lia",
- "ㄌㄧㄝ" : "lieh",
- "ㄌㄧㄠ" : "liao",
- "ㄌㄧㄡ" : "liou",
- "ㄌㄧㄢ" : "lian",
- "ㄌㄧㄣ" : "lin",
- "ㄌㄧㄤ" : "liang",
- "ㄌㄧㄥ" : "ling",
- "ㄌㄨ" : "lu",
- "ㄌㄨㄛ" : "luo",
- "ㄌㄨㄢ" : "luan",
- "ㄌㄨㄣ" : "lun",
- "ㄌㄨㄥ" : "long",
- "ㄌㄩ" : "lyu",
- "ㄌㄩㄝ" : "lyueh",
- "ㄌㄩㄢ" : "lyuan",
- "ㄍㄚ" : "ga",
- "ㄍㄜ" : "ge",
- "ㄍㄞ" : "gai",
- "ㄍㄟ" : "gei",
- "ㄍㄠ" : "gao",
- "ㄍㄡ" : "gou",
- "ㄍㄢ" : "gan",
- "ㄍㄣ" : "gen",
- "ㄍㄤ" : "gang",
- "ㄍㄥ" : "geng",
- "ㄍㄨ" : "gu",
- "ㄍㄨㄚ" : "gua",
- "ㄍㄨㄛ" : "guo",
- "ㄍㄨㄞ" : "guai",
- "ㄍㄨㄟ" : "guei",
- "ㄍㄨㄢ" : "guan",
- "ㄍㄨㄣ" : "gun",
- "ㄍㄨㄤ" : "guang",
- "ㄍㄨㄥ" : "gong",
- "ㄎㄚ" : "ka",
- "ㄎㄜ" : "ke",
- "ㄎㄞ" : "kai",
- "ㄎㄠ" : "kao",
- "ㄎㄡ" : "kou",
- "ㄎㄢ" : "kan",
- "ㄎㄣ" : "ken",
- "ㄎㄤ" : "kang",
- "ㄎㄥ" : "keng",
- "ㄎㄨ" : "ku",
- "ㄎㄨㄚ" : "kua",
- "ㄎㄨㄛ" : "kuo",
- "ㄎㄨㄞ" : "kuai",
- "ㄎㄨㄟ" : "kuei",
- "ㄎㄨㄢ" : "kuan",
- "ㄎㄨㄣ" : "kun",
- "ㄎㄨㄤ" : "kuang",
- "ㄎㄨㄥ" : "kong",
- "ㄏㄚ" : "ha",
- "ㄏㄜ" : "he",
- "ㄏㄞ" : "hai",
- "ㄏㄟ" : "hei",
- "ㄏㄠ" : "hao",
- "ㄏㄡ" : "hou",
- "ㄏㄢ" : "han",
- "ㄏㄣ" : "hen",
- "ㄏㄤ" : "hang",
- "ㄏㄥ" : "heng",
- "ㄏㄨ" : "hu",
- "ㄏㄨㄚ" : "hua",
- "ㄏㄨㄛ" : "huo",
- "ㄏㄨㄞ" : "huai",
- "ㄏㄨㄟ" : "huei",
- "ㄏㄨㄢ" : "huan",
- "ㄏㄨㄣ" : "hun",
- "ㄏㄨㄤ" : "huang",
- "ㄏㄨㄥ" : "hong",
- "ㄐㄧ" : "ji",
- "ㄐㄧㄚ" : "jia",
- "ㄐㄧㄝ" : "jieh",
- "ㄐㄧㄠ" : "jiao",
- "ㄐㄧㄡ" : "jiou",
- "ㄐㄧㄢ" : "jian",
- "ㄐㄧㄣ" : "jin",
- "ㄐㄧㄤ" : "jiang",
- "ㄐㄧㄥ" : "jing",
- "ㄐㄩ" : "jyu",
- "ㄐㄩㄝ" : "jyueh",
- "ㄐㄩㄢ" : "jyuan",
- "ㄐㄩㄣ" : "jyun",
- "ㄐㄩㄥ" : "jyong",
- "ㄑㄧ" : "chi",
- "ㄑㄧㄚ" : "chia",
- "ㄑㄧㄝ" : "chieh",
- "ㄑㄧㄠ" : "chiao",
- "ㄑㄧㄡ" : "chiou",
- "ㄑㄧㄢ" : "chian",
- "ㄑㄧㄣ" : "chin",
- "ㄑㄧㄤ" : "chiang",
- "ㄑㄧㄥ" : "ching",
- "ㄑㄩ" : "chyu",
- "ㄑㄩㄝ" : "chyueh",
- "ㄑㄩㄢ" : "chyuan",
- "ㄑㄩㄣ" : "chyun",
- "ㄑㄩㄥ" : "chyong",
- "ㄒㄧ" : "si",
- "ㄒㄧㄚ" : "sia",
- "ㄒㄧㄝ" : "sieh",
- "ㄒㄧㄠ" : "siao",
- "ㄒㄧㄡ" : "siou",
- "ㄒㄧㄢ" : "sian",
- "ㄒㄧㄣ" : "sin",
- "ㄒㄧㄤ" : "siang",
- "ㄒㄧㄥ" : "sing",
- "ㄒㄩ" : "syu",
- "ㄒㄩㄝ" : "syueh",
- "ㄒㄩㄢ" : "syuan",
- "ㄒㄩㄣ" : "syun",
- "ㄒㄩㄥ" : "syong",
- "ㄓ" : "jhih",
- "ㄓㄚ" : "jha",
- "ㄓㄜ" : "jhe",
- "ㄓㄞ" : "jhai",
- "ㄓㄟ" : "jhei",
- "ㄓㄠ" : "jhao",
- "ㄓㄡ" : "jhou",
- "ㄓㄢ" : "jhan",
- "ㄓㄣ" : "jhen",
- "ㄓㄤ" : "jhang",
- "ㄓㄥ" : "jheng",
- "ㄓㄨ" : "jhu",
- "ㄓㄨㄚ" : "jhua",
- "ㄓㄨㄛ" : "jhuo",
- "ㄓㄨㄞ" : "jhuai",
- "ㄓㄨㄟ" : "jhuei",
- "ㄓㄨㄢ" : "jhuan",
- "ㄓㄨㄣ" : "jhun",
- "ㄓㄨㄤ" : "jhuang",
- "ㄓㄨㄥ" : "jhong",
- "ㄔ" : "chih",
- "ㄔㄚ" : "cha",
- "ㄔㄜ" : "che",
- "ㄔㄞ" : "chai",
- "ㄔㄠ" : "chao",
- "ㄔㄡ" : "chou",
- "ㄔㄢ" : "chan",
- "ㄔㄣ" : "chen",
- "ㄔㄤ" : "chang",
- "ㄔㄥ" : "cheng",
- "ㄔㄨ" : "chu",
- "ㄔㄨㄛ" : "chuo",
- "ㄔㄨㄞ" : "chuai",
- "ㄔㄨㄟ" : "chuei",
- "ㄔㄨㄢ" : "chuan",
- "ㄔㄨㄣ" : "chun",
- "ㄔㄨㄤ" : "chuang",
- "ㄔㄨㄥ" : "chong",
- "ㄕ" : "shih",
- "ㄕㄚ" : "sha",
- "ㄕㄜ" : "she",
- "ㄕㄞ" : "shai",
- "ㄕㄟ" : "shei",
- "ㄕㄠ" : "shao",
- "ㄕㄡ" : "shou",
- "ㄕㄢ" : "shan",
- "ㄕㄣ" : "shen",
- "ㄕㄤ" : "shang",
- "ㄕㄥ" : "sheng",
- "ㄕㄨ" : "shu",
- "ㄕㄨㄚ" : "shua",
- "ㄕㄨㄛ" : "shuo",
- "ㄕㄨㄞ" : "shuai",
- "ㄕㄨㄟ" : "shuei",
- "ㄕㄨㄢ" : "shuan",
- "ㄕㄨㄣ" : "shun",
- "ㄕㄨㄤ" : "shuang",
- "ㄖ" : "rih",
- "ㄖㄜ" : "re",
- "ㄖㄠ" : "rao",
- "ㄖㄡ" : "rou",
- "ㄖㄢ" : "ran",
- "ㄖㄣ" : "ren",
- "ㄖㄤ" : "rang",
- "ㄖㄥ" : "reng",
- "ㄖㄨ" : "ru",
- "ㄖㄨㄛ" : "ruo",
- "ㄖㄨㄟ" : "ruei",
- "ㄖㄨㄢ" : "ruan",
- "ㄖㄨㄣ" : "run",
- "ㄖㄨㄥ" : "rong",
- "ㄗ" : "zih",
- "ㄗㄚ" : "za",
- "ㄗㄜ" : "ze",
- "ㄗㄞ" : "zai",
- "ㄗㄟ" : "zei",
- "ㄗㄠ" : "zao",
- "ㄗㄡ" : "zou",
- "ㄗㄢ" : "zan",
- "ㄗㄣ" : "zen",
- "ㄗㄤ" : "zang",
- "ㄗㄥ" : "zeng",
- "ㄗㄨ" : "zu",
- "ㄗㄨㄛ" : "zuo",
- "ㄗㄨㄟ" : "zuei",
- "ㄗㄨㄢ" : "zuan",
- "ㄗㄨㄣ" : "zun",
- "ㄗㄨㄥ" : "zong",
- "ㄘ" : "tsih",
- "ㄘㄚ" : "tsa",
- "ㄘㄜ" : "tse",
- "ㄘㄞ" : "tsai",
- "ㄘㄠ" : "tsao",
- "ㄘㄡ" : "tsou",
- "ㄘㄢ" : "tsan",
- "ㄘㄣ" : "tsen",
- "ㄘㄤ" : "tsang",
- "ㄘㄥ" : "tseng",
- "ㄘㄨ" : "tsu",
- "ㄘㄨㄛ" : "tsuo",
- "ㄘㄨㄟ" : "tsuei",
- "ㄘㄨㄢ" : "tsuan",
- "ㄘㄨㄣ" : "tsun",
- "ㄘㄨㄥ" : "tsong",
- "ㄙ" : "sih",
- "ㄙㄚ" : "sa",
- "ㄙㄜ" : "se",
- "ㄙㄞ" : "sai",
- "ㄙㄠ" : "sao",
- "ㄙㄡ" : "sou",
- "ㄙㄢ" : "san",
- "ㄙㄣ" : "sen",
- "ㄙㄤ" : "sang",
- "ㄙㄥ" : "seng",
- "ㄙㄨ" : "su",
- "ㄙㄨㄛ" : "suo",
- "ㄙㄨㄟ" : "suei",
- "ㄙㄨㄢ" : "suan",
- "ㄙㄨㄣ" : "sun",
- "ㄙㄨㄥ" : "song",
- "ㄚ" : "a",
- "ㄛ" : "o",
- "ㄜ" : "e",
- "ㄝ" : "eh",
- "ㄞ" : "ai",
- "ㄟ" : "ei",
- "ㄠ" : "ao",
- "ㄡ" : "ou",
- "ㄢ" : "an",
- "ㄣ" : "en",
- "ㄤ" : "ang",
- "ㄥ" : "eng",
- "ㄦ" : "er",
- "ㄧ" : "yi",
- "ㄧㄚ" : "ya",
- "ㄧㄛ" : "yo",
- "ㄧㄝ" : "yeh",
- "ㄧㄞ" : "yai",
- "ㄧㄠ" : "yao",
- "ㄧㄡ" : "you",
- "ㄧㄢ" : "yan",
- "ㄧㄣ" : "yin",
- "ㄧㄤ" : "yang",
- "ㄧㄥ" : "ying",
- "ㄨ" : "wu",
- "ㄨㄚ" : "wa",
- "ㄨㄛ" : "wo",
- "ㄨㄞ" : "wai",
- "ㄨㄟ" : "wei",
- "ㄨㄢ" : "wan",
- "ㄨㄣ" : "wun",
- "ㄨㄤ" : "wang",
- "ㄨㄥ" : "wong",
- "ㄩ" : "yu",
- "ㄩㄝ" : "yueh",
- "ㄩㄢ" : "yuan",
- "ㄩㄣ" : "yun",
- "ㄩㄥ" : "yong",
-}
-
-
-BOPOMOFO_SECONDARY_BOPOMOFO_MAP = {
- "ㄅㄚ" : "ba",
- "ㄅㄛ" : "bo",
- "ㄅㄞ" : "bai",
- "ㄅㄟ" : "bei",
- "ㄅㄠ" : "bau",
- "ㄅㄢ" : "ban",
- "ㄅㄣ" : "ben",
- "ㄅㄤ" : "bang",
- "ㄅㄥ" : "beng",
- "ㄅㄧ" : "bi",
- "ㄅㄧㄝ" : "bie",
- "ㄅㄧㄠ" : "biau",
- "ㄅㄧㄢ" : "bian",
- "ㄅㄧㄣ" : "bin",
- "ㄅㄧㄥ" : "bing",
- "ㄅㄨ" : "bu",
- "ㄆㄚ" : "pa",
- "ㄆㄛ" : "po",
- "ㄆㄞ" : "pai",
- "ㄆㄟ" : "pei",
- "ㄆㄠ" : "pau",
- "ㄆㄡ" : "pou",
- "ㄆㄢ" : "pan",
- "ㄆㄣ" : "pen",
- "ㄆㄤ" : "pang",
- "ㄆㄥ" : "peng",
- "ㄆㄧ" : "pi",
- "ㄆㄧㄝ" : "pie",
- "ㄆㄧㄠ" : "piau",
- "ㄆㄧㄢ" : "pian",
- "ㄆㄧㄣ" : "pin",
- "ㄆㄧㄥ" : "ping",
- "ㄆㄨ" : "pu",
- "ㄇㄚ" : "ma",
- "ㄇㄛ" : "mo",
- "ㄇㄜ" : "me",
- "ㄇㄞ" : "mai",
- "ㄇㄟ" : "mei",
- "ㄇㄠ" : "mau",
- "ㄇㄡ" : "mou",
- "ㄇㄢ" : "man",
- "ㄇㄣ" : "men",
- "ㄇㄤ" : "mang",
- "ㄇㄥ" : "meng",
- "ㄇㄧ" : "mi",
- "ㄇㄧㄝ" : "mie",
- "ㄇㄧㄠ" : "miau",
- "ㄇㄧㄡ" : "miou",
- "ㄇㄧㄢ" : "mian",
- "ㄇㄧㄣ" : "min",
- "ㄇㄧㄥ" : "ming",
- "ㄇㄨ" : "mu",
- "ㄈㄚ" : "fa",
- "ㄈㄛ" : "fo",
- "ㄈㄟ" : "fei",
- "ㄈㄡ" : "fou",
- "ㄈㄢ" : "fan",
- "ㄈㄣ" : "fen",
- "ㄈㄤ" : "fang",
- "ㄈㄨ" : "fu",
- "ㄉㄚ" : "da",
- "ㄉㄜ" : "de",
- "ㄉㄞ" : "dai",
- "ㄉㄟ" : "dei",
- "ㄉㄠ" : "dau",
- "ㄉㄡ" : "dou",
- "ㄉㄢ" : "dan",
- "ㄉㄤ" : "dang",
- "ㄉㄥ" : "deng",
- "ㄉㄧ" : "di",
- "ㄉㄧㄝ" : "die",
- "ㄉㄧㄠ" : "diau",
- "ㄉㄧㄡ" : "diou",
- "ㄉㄧㄢ" : "dian",
- "ㄉㄧㄥ" : "ding",
- "ㄉㄨ" : "du",
- "ㄉㄨㄛ" : "duo",
- "ㄉㄨㄟ" : "duei",
- "ㄉㄨㄢ" : "duan",
- "ㄉㄨㄣ" : "duen",
- "ㄉㄨㄥ" : "dung",
- "ㄊㄚ" : "ta",
- "ㄊㄜ" : "te",
- "ㄊㄞ" : "tai",
- "ㄊㄠ" : "tau",
- "ㄊㄡ" : "tou",
- "ㄊㄢ" : "tan",
- "ㄊㄤ" : "tang",
- "ㄊㄥ" : "teng",
- "ㄊㄧ" : "ti",
- "ㄊㄧㄝ" : "tie",
- "ㄊㄧㄠ" : "tiau",
- "ㄊㄧㄢ" : "tian",
- "ㄊㄧㄥ" : "ting",
- "ㄊㄨ" : "tu",
- "ㄊㄨㄛ" : "tuo",
- "ㄊㄨㄟ" : "tuei",
- "ㄊㄨㄢ" : "tuan",
- "ㄊㄨㄣ" : "tuen",
- "ㄊㄨㄥ" : "tung",
- "ㄋㄚ" : "na",
- "ㄋㄜ" : "ne",
- "ㄋㄞ" : "nai",
- "ㄋㄟ" : "nei",
- "ㄋㄠ" : "nau",
- "ㄋㄡ" : "nou",
- "ㄋㄢ" : "nan",
- "ㄋㄣ" : "nen",
- "ㄋㄤ" : "nang",
- "ㄋㄥ" : "neng",
- "ㄋㄧ" : "ni",
- "ㄋㄧㄝ" : "nie",
- "ㄋㄧㄠ" : "niau",
- "ㄋㄧㄡ" : "niou",
- "ㄋㄧㄢ" : "nian",
- "ㄋㄧㄣ" : "nin",
- "ㄋㄧㄤ" : "niang",
- "ㄋㄧㄥ" : "ning",
- "ㄋㄨ" : "nu",
- "ㄋㄨㄛ" : "nuo",
- "ㄋㄨㄢ" : "nuan",
- "ㄋㄨㄣ" : "nuen",
- "ㄋㄨㄥ" : "nung",
- "ㄋㄩ" : "niu",
- "ㄋㄩㄝ" : "niue",
- "ㄌㄚ" : "la",
- "ㄌㄛ" : "lo",
- "ㄌㄜ" : "le",
- "ㄌㄞ" : "lai",
- "ㄌㄟ" : "lei",
- "ㄌㄠ" : "lau",
- "ㄌㄡ" : "lou",
- "ㄌㄢ" : "lan",
- "ㄌㄤ" : "lang",
- "ㄌㄥ" : "leng",
- "ㄌㄧ" : "li",
- "ㄌㄧㄚ" : "lia",
- "ㄌㄧㄝ" : "lie",
- "ㄌㄧㄠ" : "liau",
- "ㄌㄧㄡ" : "liou",
- "ㄌㄧㄢ" : "lian",
- "ㄌㄧㄣ" : "lin",
- "ㄌㄧㄤ" : "liang",
- "ㄌㄧㄥ" : "ling",
- "ㄌㄨ" : "lu",
- "ㄌㄨㄛ" : "luo",
- "ㄌㄨㄢ" : "luan",
- "ㄌㄨㄣ" : "luen",
- "ㄌㄨㄥ" : "lung",
- "ㄌㄩ" : "liu",
- "ㄌㄩㄝ" : "liue",
- "ㄌㄩㄢ" : "liuan",
- "ㄍㄚ" : "ga",
- "ㄍㄜ" : "ge",
- "ㄍㄞ" : "gai",
- "ㄍㄟ" : "gei",
- "ㄍㄠ" : "gau",
- "ㄍㄡ" : "gou",
- "ㄍㄢ" : "gan",
- "ㄍㄣ" : "gen",
- "ㄍㄤ" : "gang",
- "ㄍㄥ" : "geng",
- "ㄍㄨ" : "gu",
- "ㄍㄨㄚ" : "gua",
- "ㄍㄨㄛ" : "guo",
- "ㄍㄨㄞ" : "guai",
- "ㄍㄨㄟ" : "guei",
- "ㄍㄨㄢ" : "guan",
- "ㄍㄨㄣ" : "guen",
- "ㄍㄨㄤ" : "guang",
- "ㄍㄨㄥ" : "gung",
- "ㄎㄚ" : "ka",
- "ㄎㄜ" : "ke",
- "ㄎㄞ" : "kai",
- "ㄎㄠ" : "kau",
- "ㄎㄡ" : "kou",
- "ㄎㄢ" : "kan",
- "ㄎㄣ" : "ken",
- "ㄎㄤ" : "kang",
- "ㄎㄥ" : "keng",
- "ㄎㄨ" : "ku",
- "ㄎㄨㄚ" : "kua",
- "ㄎㄨㄛ" : "kuo",
- "ㄎㄨㄞ" : "kuai",
- "ㄎㄨㄟ" : "kuei",
- "ㄎㄨㄢ" : "kuan",
- "ㄎㄨㄣ" : "kuen",
- "ㄎㄨㄤ" : "kuang",
- "ㄎㄨㄥ" : "kung",
- "ㄏㄚ" : "ha",
- "ㄏㄜ" : "he",
- "ㄏㄞ" : "hai",
- "ㄏㄟ" : "hei",
- "ㄏㄠ" : "hau",
- "ㄏㄡ" : "hou",
- "ㄏㄢ" : "han",
- "ㄏㄣ" : "hen",
- "ㄏㄤ" : "hang",
- "ㄏㄥ" : "heng",
- "ㄏㄨ" : "hu",
- "ㄏㄨㄚ" : "hua",
- "ㄏㄨㄛ" : "huo",
- "ㄏㄨㄞ" : "huai",
- "ㄏㄨㄟ" : "huei",
- "ㄏㄨㄢ" : "huan",
- "ㄏㄨㄣ" : "huen",
- "ㄏㄨㄤ" : "huang",
- "ㄏㄨㄥ" : "hung",
- "ㄐㄧ" : "ji",
- "ㄐㄧㄚ" : "jia",
- "ㄐㄧㄝ" : "jie",
- "ㄐㄧㄠ" : "jiau",
- "ㄐㄧㄡ" : "jiou",
- "ㄐㄧㄢ" : "jian",
- "ㄐㄧㄣ" : "jin",
- "ㄐㄧㄤ" : "jiang",
- "ㄐㄧㄥ" : "jing",
- "ㄐㄩ" : "jiu",
- "ㄐㄩㄝ" : "jiue",
- "ㄐㄩㄢ" : "jiuan",
- "ㄐㄩㄣ" : "jiun",
- "ㄐㄩㄥ" : "jiung",
- "ㄑㄧ" : "chi",
- "ㄑㄧㄚ" : "chia",
- "ㄑㄧㄝ" : "chie",
- "ㄑㄧㄠ" : "chiau",
- "ㄑㄧㄡ" : "chiou",
- "ㄑㄧㄢ" : "chian",
- "ㄑㄧㄣ" : "chin",
- "ㄑㄧㄤ" : "chiang",
- "ㄑㄧㄥ" : "ching",
- "ㄑㄩ" : "chiu",
- "ㄑㄩㄝ" : "chiue",
- "ㄑㄩㄢ" : "chiuan",
- "ㄑㄩㄣ" : "chiun",
- "ㄑㄩㄥ" : "chiung",
- "ㄒㄧ" : "shi",
- "ㄒㄧㄚ" : "shia",
- "ㄒㄧㄝ" : "shie",
- "ㄒㄧㄠ" : "shiau",
- "ㄒㄧㄡ" : "shiou",
- "ㄒㄧㄢ" : "shian",
- "ㄒㄧㄣ" : "shin",
- "ㄒㄧㄤ" : "shiang",
- "ㄒㄧㄥ" : "shing",
- "ㄒㄩ" : "shiu",
- "ㄒㄩㄝ" : "shiue",
- "ㄒㄩㄢ" : "shiuan",
- "ㄒㄩㄣ" : "shiun",
- "ㄒㄩㄥ" : "shiung",
- "ㄓ" : "jr",
- "ㄓㄚ" : "ja",
- "ㄓㄜ" : "je",
- "ㄓㄞ" : "jai",
- "ㄓㄟ" : "jei",
- "ㄓㄠ" : "jau",
- "ㄓㄡ" : "jou",
- "ㄓㄢ" : "jan",
- "ㄓㄣ" : "jen",
- "ㄓㄤ" : "jang",
- "ㄓㄥ" : "jeng",
- "ㄓㄨ" : "ju",
- "ㄓㄨㄚ" : "jua",
- "ㄓㄨㄛ" : "juo",
- "ㄓㄨㄞ" : "juai",
- "ㄓㄨㄟ" : "juei",
- "ㄓㄨㄢ" : "juan",
- "ㄓㄨㄣ" : "juen",
- "ㄓㄨㄤ" : "juang",
- "ㄓㄨㄥ" : "jung",
- "ㄔ" : "chr",
- "ㄔㄚ" : "cha",
- "ㄔㄜ" : "che",
- "ㄔㄞ" : "chai",
- "ㄔㄠ" : "chau",
- "ㄔㄡ" : "chou",
- "ㄔㄢ" : "chan",
- "ㄔㄣ" : "chen",
- "ㄔㄤ" : "chang",
- "ㄔㄥ" : "cheng",
- "ㄔㄨ" : "chu",
- "ㄔㄨㄛ" : "chuo",
- "ㄔㄨㄞ" : "chuai",
- "ㄔㄨㄟ" : "chuei",
- "ㄔㄨㄢ" : "chuan",
- "ㄔㄨㄣ" : "chuen",
- "ㄔㄨㄤ" : "chuang",
- "ㄔㄨㄥ" : "chung",
- "ㄕ" : "shr",
- "ㄕㄚ" : "sha",
- "ㄕㄜ" : "she",
- "ㄕㄞ" : "shai",
- "ㄕㄟ" : "shei",
- "ㄕㄠ" : "shau",
- "ㄕㄡ" : "shou",
- "ㄕㄢ" : "shan",
- "ㄕㄣ" : "shen",
- "ㄕㄤ" : "shang",
- "ㄕㄥ" : "sheng",
- "ㄕㄨ" : "shu",
- "ㄕㄨㄚ" : "shua",
- "ㄕㄨㄛ" : "shuo",
- "ㄕㄨㄞ" : "shuai",
- "ㄕㄨㄟ" : "shuei",
- "ㄕㄨㄢ" : "shuan",
- "ㄕㄨㄣ" : "shuen",
- "ㄕㄨㄤ" : "shuang",
- "ㄖ" : "r",
- "ㄖㄜ" : "re",
- "ㄖㄠ" : "rau",
- "ㄖㄡ" : "rou",
- "ㄖㄢ" : "ran",
- "ㄖㄣ" : "ren",
- "ㄖㄤ" : "rang",
- "ㄖㄥ" : "reng",
- "ㄖㄨ" : "ru",
- "ㄖㄨㄛ" : "ruo",
- "ㄖㄨㄟ" : "ruei",
- "ㄖㄨㄢ" : "ruan",
- "ㄖㄨㄣ" : "ruen",
- "ㄖㄨㄥ" : "rung",
- "ㄗ" : "tz",
- "ㄗㄚ" : "tza",
- "ㄗㄜ" : "tze",
- "ㄗㄞ" : "tzai",
- "ㄗㄟ" : "tzei",
- "ㄗㄠ" : "tzau",
- "ㄗㄡ" : "tzou",
- "ㄗㄢ" : "tzan",
- "ㄗㄣ" : "tzen",
- "ㄗㄤ" : "tzang",
- "ㄗㄥ" : "tzeng",
- "ㄗㄨ" : "tzu",
- "ㄗㄨㄛ" : "tzuo",
- "ㄗㄨㄟ" : "tzuei",
- "ㄗㄨㄢ" : "tzuan",
- "ㄗㄨㄣ" : "tzuen",
- "ㄗㄨㄥ" : "tzung",
- "ㄘ" : "tsz",
- "ㄘㄚ" : "tsa",
- "ㄘㄜ" : "tse",
- "ㄘㄞ" : "tsai",
- "ㄘㄠ" : "tsau",
- "ㄘㄡ" : "tsou",
- "ㄘㄢ" : "tsan",
- "ㄘㄣ" : "tsen",
- "ㄘㄤ" : "tsang",
- "ㄘㄥ" : "tseng",
- "ㄘㄨ" : "tsu",
- "ㄘㄨㄛ" : "tsuo",
- "ㄘㄨㄟ" : "tsuei",
- "ㄘㄨㄢ" : "tsuan",
- "ㄘㄨㄣ" : "tsun",
- "ㄘㄨㄥ" : "tsung",
- "ㄙ" : "sz",
- "ㄙㄚ" : "sa",
- "ㄙㄜ" : "se",
- "ㄙㄞ" : "sai",
- "ㄙㄠ" : "sau",
- "ㄙㄡ" : "sou",
- "ㄙㄢ" : "san",
- "ㄙㄣ" : "sen",
- "ㄙㄤ" : "sang",
- "ㄙㄥ" : "seng",
- "ㄙㄨ" : "su",
- "ㄙㄨㄛ" : "suo",
- "ㄙㄨㄟ" : "suei",
- "ㄙㄨㄢ" : "suan",
- "ㄙㄨㄣ" : "suen",
- "ㄙㄨㄥ" : "sung",
- "ㄚ" : "a",
- "ㄛ" : "o",
- "ㄜ" : "e",
- "ㄝ" : "ê",
- "ㄞ" : "ai",
- "ㄟ" : "ei",
- "ㄠ" : "au",
- "ㄡ" : "ou",
- "ㄢ" : "an",
- "ㄣ" : "en",
- "ㄤ" : "ang",
- "ㄥ" : "eng",
- "ㄦ" : "er",
- "ㄧ" : "yi",
- "ㄧㄚ" : "ya",
- "ㄧㄛ" : "yo",
- "ㄧㄝ" : "ye",
- "ㄧㄞ" : "yai",
- "ㄧㄠ" : "yau",
- "ㄧㄡ" : "you",
- "ㄧㄢ" : "yan",
- "ㄧㄣ" : "yin",
- "ㄧㄤ" : "yang",
- "ㄧㄥ" : "ying",
- "ㄨ" : "wu",
- "ㄨㄚ" : "wa",
- "ㄨㄛ" : "wo",
- "ㄨㄞ" : "wai",
- "ㄨㄟ" : "wei",
- "ㄨㄢ" : "wan",
- "ㄨㄣ" : "wen",
- "ㄨㄤ" : "wang",
- "ㄨㄥ" : "weng",
- "ㄩ" : "yu",
- "ㄩㄝ" : "yue",
- "ㄩㄢ" : "yuan",
- "ㄩㄣ" : "yun",
- "ㄩㄥ" : "yung",
-}
diff --git a/scripts/bopomofokeyboard.py b/scripts/bopomofokeyboard.py
deleted file mode 100644
index ae9bc59..0000000
--- a/scripts/bopomofokeyboard.py
+++ /dev/null
@@ -1,105 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim:set et sts=4 sw=4:
-#
-# libzhuyin - Library to deal with zhuyin.
-#
-# Copyright (C) 2013 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.
-
-bopomofo_symbols = [
- 'ㄅ', 'ㄆ', 'ㄇ', 'ㄈ', 'ㄉ', 'ㄊ', 'ㄋ', 'ㄌ', 'ㄍ', 'ㄎ',
- 'ㄏ', 'ㄐ', 'ㄑ', 'ㄒ', 'ㄓ', 'ㄔ', 'ㄕ', 'ㄖ', 'ㄗ', 'ㄘ', 'ㄙ',
-
- 'ㄧ', 'ㄨ', 'ㄩ', 'ㄚ', 'ㄛ', 'ㄜ', 'ㄝ', 'ㄞ', 'ㄟ', 'ㄠ', 'ㄡ',
- 'ㄢ', 'ㄣ', 'ㄤ', 'ㄥ', 'ㄦ',
-
- 'ˉ', 'ˊ', 'ˇ', 'ˋ', '˙',
-]
-
-#陰平聲不標號, use space key
-
-bopomofo_symbol_range = (0, -5)
-bopomofo_initial_range = (0, 21)
-bopomofo_middle_range = (21, 24)
-bopomofo_final_range = (24, -5)
-bopomofo_tone_range = (-5, None)
-
-bopomofo_keyboards = {
- #標準注音鍵盤
- 'STANDARD':
- (
- "1","q","a","z","2","w","s","x","e","d","c","r","f","v","5","t","g","b","y","h","n",
- "u","j","m","8","i","k",",","9","o","l",".","0","p",";","/","-",
- " ","6","3","4","7",
- ),
- #精業注音鍵盤
- 'GINYIEH':
- (
- "2","w","s","x","3","e","d","c","r","f","v","t","g","b","6","y","h","n","u","j","m",
- "8","i","k",",","9","o","l",".","0","p",";","/","-","[","'","=",
- " ","q","a","z","1",
- ),
- #倚天注音鍵盤
- 'ETEN':
- (
- "b","p","m","f","d","t","n","l","v","k","h","g","7","c",",",".","/","j",";","'","s",
- "e","x","u","a","o","r","w","i","q","z","y","8","9","0","-","=",
- " ","2","3","4","1",
- ),
- #IBM注音鍵盤
- 'IBM':
- (
- "1","2","3","4","5","6","7","8","9","0","-","q","w","e","r","t","y","u","i","o","p",
- "a","s","d","f","g","h","j","k","l",";","z","x","c","v","b","n",
- " ","m",",",".","/",
- ),
- #許氏注音鍵盤
- 'HSU':
- (
- "b","p","m","f","d","t","n","l","g","k","h","j","v","c","j","v","c","r","z","a","s",
- "e","x","u","y","h","g","e","i","a","w","o","m","n","k","l","l",
- " ","d","f","j","s",
- ),
- #倚天26鍵注音鍵盤
- 'ETEN26':
- (
- "b","p","m","f","d","t","n","l","v","k","h","g","v","c","g","y","c","j","q","w","s",
- "e","x","u","a","o","r","w","i","q","z","p","m","n","t","l","h",
- " ","f","j","k","d",
- ),
- #標準(Dvorak)注音鍵盤
- 'Dvorak-STANDARD':
- (
- "1","'","a",";","2",",","o","q",".","e","j","p","u","k","5","y","i","x","f","d","b",
- "g","h","m","8","c","t","w","9","r","n","v","0","l","s","z","[",
- " ","6","3","4","7",
- ),
- #許氏(Dvorak)注音鍵盤
- 'Dvorak-HSU':
- (
- "b","p","m","f","d","t","n","l","g","k","h","j","v","c","j","v","c","r","z","a","s",
- "e","x","u","y","h","g","e","i","a","w","o","m","n","k","l","l",
- " ","d","f","j","s",
- ),
- #大千26鍵注音鍵盤
- 'DACHEN-CP26':
- (
- "q","q","a","z","w","w","s","x","e","d","c","r","f","v","t","t","g","b","y","h","n",
- "u","j","m","u","i","k","b","i","o","l","m","o","p","l","n","p",
- " ","e","r","d","y",
- ),
-}
-
diff --git a/scripts/chewing.py b/scripts/chewing.py
deleted file mode 100644
index 0ef7c18..0000000
--- a/scripts/chewing.py
+++ /dev/null
@@ -1,73 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim:set et sts=4 sw=4:
-#
-# libzhuyin - Library to deal with zhuyin.
-#
-# 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.
-
-
-ASCII_CHEWING_INITIAL_MAP = {
- "CHEWING_B" : "ㄅ",
- "CHEWING_C" : "ㄘ",
- "CHEWING_CH" : "ㄔ",
- "CHEWING_D" : "ㄉ",
- "CHEWING_F" : "ㄈ",
- "CHEWING_H" : "ㄏ",
- "CHEWING_G" : "ㄍ",
- "CHEWING_K" : "ㄎ",
- "CHEWING_J" : "ㄐ",
- "CHEWING_M" : "ㄇ",
- "CHEWING_N" : "ㄋ",
- "CHEWING_L" : "ㄌ",
- "CHEWING_R" : "ㄖ",
- "CHEWING_P" : "ㄆ",
- "CHEWING_Q" : "ㄑ",
- "CHEWING_S" : "ㄙ",
- "CHEWING_SH" : "ㄕ",
- "CHEWING_T" : "ㄊ",
- "CHEWING_X" : "ㄒ",
- "CHEWING_Z" : "ㄗ",
- "CHEWING_ZH" : "ㄓ",
-}
-
-CHEWING_ASCII_INITIAL_MAP = dict([(v, k) for k, v in ASCII_CHEWING_INITIAL_MAP.items()])
-
-ASCII_CHEWING_MIDDLE_MAP = {
- "CHEWING_I" : "ㄧ",
- "CHEWING_U" : "ㄨ",
- "CHEWING_V" : "ㄩ",
-}
-
-CHEWING_ASCII_MIDDLE_MAP = dict([(v, k) for k, v in ASCII_CHEWING_MIDDLE_MAP.items()])
-
-ASCII_CHEWING_FINAL_MAP = {
- "CHEWING_A" : "ㄚ",
- "CHEWING_AI" : "ㄞ",
- "CHEWING_AN" : "ㄢ",
- "CHEWING_ANG" : "ㄤ",
- "CHEWING_AO" : "ㄠ",
- "CHEWING_E" : "ㄝ", # merge "ㄝ" and "ㄜ"
- "CHEWING_EI" : "ㄟ",
- "CHEWING_EN" : "ㄣ",
- "CHEWING_ENG" : "ㄥ",
- "CHEWING_ER" : "ㄦ",
- "CHEWING_NG" : "ㄫ",
- "CHEWING_O" : "ㄛ",
- "CHEWING_OU" : "ㄡ",
-}
-
-CHEWING_ASCII_FINAL_MAP = dict([(v, k) for k, v in ASCII_CHEWING_FINAL_MAP.items()])
diff --git a/scripts/chewing_enum.h.in b/scripts/chewing_enum.h.in
deleted file mode 100644
index e33d020..0000000
--- a/scripts/chewing_enum.h.in
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef CHEWING_ENUM_H
-#define CHEWING_ENUM_H
-
-namespace zhuyin{
-
-/**
- * @brief enums of chewing initial element.
- */
-
-enum ChewingInitial
-{
-@CHEWING_INITIAL@
-};
-
-
-/**
- * @brief enums of chewing middle element.
- */
-
-enum ChewingMiddle
-{
-@CHEWING_MIDDLE@
-};
-
-
-/**
- * @brief enums of chewing final element.
- */
-enum ChewingFinal
-{
-@CHEWING_FINAL@
-};
-
-
-/**
- * @brief enums of chewing tone element.
- */
-enum ChewingTone
-{
-@CHEWING_TONE@
-};
-
-};
-
-#endif
diff --git a/scripts/chewing_table.h.in b/scripts/chewing_table.h.in
deleted file mode 100644
index d0d0f59..0000000
--- a/scripts/chewing_table.h.in
+++ /dev/null
@@ -1,121 +0,0 @@
-#ifndef CHEWING_TABLE_H
-#define CHEWING_TABLE_H
-
-namespace zhuyin{
-
-const chewing_symbol_item_t chewing_standard_symbols[] = {
-@STANDARD_SYMBOLS@
-};
-
-const chewing_tone_item_t chewing_standard_tones[] = {
-@STANDARD_TONES@
-};
-
-const chewing_symbol_item_t chewing_ginyieh_symbols[] = {
-@GINYIEH_SYMBOLS@
-};
-
-const chewing_tone_item_t chewing_ginyieh_tones[] = {
-@GINYIEH_TONES@
-};
-
-const chewing_symbol_item_t chewing_eten_symbols[] = {
-@ETEN_SYMBOLS@
-};
-
-const chewing_tone_item_t chewing_eten_tones[] = {
-@ETEN_TONES@
-};
-
-const chewing_symbol_item_t chewing_ibm_symbols[] = {
-@IBM_SYMBOLS@
-};
-
-const chewing_tone_item_t chewing_ibm_tones[] = {
-@IBM_TONES@
-};
-
-const chewing_symbol_item_t chewing_hsu_initials[] = {
-@HSU_INITIALS@
-};
-
-const chewing_symbol_item_t chewing_hsu_middles[] = {
-@HSU_MIDDLES@
-};
-
-const chewing_symbol_item_t chewing_hsu_finals[] = {
-@HSU_FINALS@
-};
-
-const chewing_tone_item_t chewing_hsu_tones[] = {
-@HSU_TONES@
-};
-
-const chewing_symbol_item_t chewing_eten26_initials[] = {
-@ETEN26_INITIALS@
-};
-
-const chewing_symbol_item_t chewing_eten26_middles[] = {
-@ETEN26_MIDDLES@
-};
-
-const chewing_symbol_item_t chewing_eten26_finals[] = {
-@ETEN26_FINALS@
-};
-
-const chewing_tone_item_t chewing_eten26_tones[] = {
-@ETEN26_TONES@
-};
-
-const chewing_symbol_item_t chewing_standard_dvorak_symbols[] = {
-@Dvorak-STANDARD_SYMBOLS@
-};
-
-const chewing_tone_item_t chewing_standard_dvorak_tones[] = {
-@Dvorak-STANDARD_TONES@
-};
-
-const chewing_symbol_item_t chewing_hsu_dvorak_initials[] = {
-@Dvorak-HSU_INITIALS@
-};
-
-const chewing_symbol_item_t chewing_hsu_dvorak_middles[] = {
-@Dvorak-HSU_MIDDLES@
-};
-
-const chewing_symbol_item_t chewing_hsu_dvorak_finals[] = {
-@Dvorak-HSU_FINALS@
-};
-
-const chewing_tone_item_t chewing_hsu_dvorak_tones[] = {
-@Dvorak-HSU_TONES@
-};
-
-const chewing_symbol_item_t chewing_dachen_cp26_initials[] = {
-@DACHEN-CP26_INITIALS@
-};
-
-const chewing_symbol_item_t chewing_dachen_cp26_middles[] = {
-@DACHEN-CP26_MIDDLES@
-};
-
-const chewing_symbol_item_t chewing_dachen_cp26_finals[] = {
-@DACHEN-CP26_FINALS@
-};
-
-const chewing_tone_item_t chewing_dachen_cp26_tones[] = {
-@DACHEN-CP26_TONES@
-};
-
-const char * chewing_tone_table[CHEWING_NUMBER_OF_TONES] = {
-"",
-" ",
-"ˊ",
-"ˇ",
-"ˋ",
-"˙"
-};
-
-};
-
-#endif
diff --git a/scripts/chewingkey.py b/scripts/chewingkey.py
deleted file mode 100644
index c0db5d3..0000000
--- a/scripts/chewingkey.py
+++ /dev/null
@@ -1,150 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim:set et sts=4 sw=4:
-#
-# libzhuyin - Library to deal with zhuyin.
-#
-# 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.
-
-
-CHEWING_INITIAL_LIST = [
- 'CHEWING_ZERO_INITIAL', #Zero Initial
- 'CHEWING_B', #"ㄅ"
- 'CHEWING_C', #"ㄘ"
- 'CHEWING_CH', #"ㄔ"
- 'CHEWING_D', #"ㄉ"
- 'CHEWING_F', #"ㄈ"
- 'CHEWING_H', #"ㄏ"
- 'CHEWING_G', #"ㄍ"
- 'CHEWING_K', #"ㄎ"
- 'CHEWING_J', #"ㄐ"
- 'CHEWING_M', #"ㄇ"
- 'CHEWING_N', #"ㄋ"
- 'CHEWING_L', #"ㄌ"
- 'CHEWING_R', #"ㄖ"
- 'CHEWING_P', #"ㄆ"
- 'CHEWING_Q', #"ㄑ"
- 'CHEWING_S', #"ㄙ"
- 'CHEWING_SH', #"ㄕ"
- 'CHEWING_T', #"ㄊ"
- 'PINYIN_W', #Invalid Chewing
- 'CHEWING_X', #"ㄒ"
- 'PINYIN_Y', #Invalid Chewing
- 'CHEWING_Z', #"ㄗ"
- 'CHEWING_ZH' #"ㄓ"
-]
-
-
-CHEWING_MIDDLE_LIST = [
- 'CHEWING_ZERO_MIDDLE', #Zero Middle
- 'CHEWING_I', #"ㄧ"
- 'CHEWING_U', #"ㄨ"
- 'CHEWING_V' #"ㄩ"
-]
-
-
-CHEWING_FINAL_LIST = [
- 'CHEWING_ZERO_FINAL', #Zero Final
- 'CHEWING_A', #"ㄚ"
- 'CHEWING_AI', #"ㄞ"
- 'CHEWING_AN', #"ㄢ"
- 'CHEWING_ANG', #"ㄤ"
- 'CHEWING_AO', #"ㄠ"
- 'CHEWING_E', #"ㄝ" and "ㄜ"
- 'INVALID_EA', #Invalid Pinyin/Chewing
- 'CHEWING_EI', #"ㄟ"
- 'CHEWING_EN', #"ㄣ"
- 'CHEWING_ENG', #"ㄥ"
- 'CHEWING_ER', #"ㄦ"
- 'CHEWING_NG', #"ㄫ"
- 'CHEWING_O', #"ㄛ"
- 'PINYIN_ONG', #"ueng"
- 'CHEWING_OU', #"ㄡ"
- 'PINYIN_IN', #"ien"
- 'PINYIN_ING' #"ieng"
-]
-
-
-CHEWING_TONE_LIST = [
- 'CHEWING_ZERO_TONE', #Zero Tone
- 'CHEWING_1', #" "
- 'CHEWING_2', #'ˊ'
- 'CHEWING_3', #'ˇ'
- 'CHEWING_4', #'ˋ'
- 'CHEWING_5' #'˙'
-]
-
-
-def gen_entries(items, last_enum, num_enum):
- entries = []
- for enum, item in enumerate(items, start=0):
- entry = '{0} = {1}'.format(item, enum)
- entries.append(entry)
-
- #last enum
- entry = last_enum + ' = ' + items[-1]
- entries.append(entry)
-
- #num enum
- entry = num_enum
- entries.append(entry)
-
- return ",\n".join(entries)
-
-
-def gen_initials():
- return gen_entries(CHEWING_INITIAL_LIST, 'CHEWING_LAST_INITIAL',
- 'CHEWING_NUMBER_OF_INITIALS = CHEWING_LAST_INITIAL + 1')
-
-
-def gen_middles():
- return gen_entries(CHEWING_MIDDLE_LIST, 'CHEWING_LAST_MIDDLE',
- 'CHEWING_NUMBER_OF_MIDDLES = CHEWING_LAST_MIDDLE + 1')
-
-
-def gen_finals():
- return gen_entries(CHEWING_FINAL_LIST, 'CHEWING_LAST_FINAL',
- 'CHEWING_NUMBER_OF_FINALS = CHEWING_LAST_FINAL + 1')
-
-
-def gen_tones():
- return gen_entries(CHEWING_TONE_LIST, 'CHEWING_LAST_TONE',
- 'CHEWING_NUMBER_OF_TONES = CHEWING_LAST_TONE + 1')
-
-
-def gen_table_index(content_table):
- entries = []
- for i in range(0, len(CHEWING_INITIAL_LIST)):
- initial = CHEWING_INITIAL_LIST[i]
- for m in range(0, len(CHEWING_MIDDLE_LIST)):
- middle = CHEWING_MIDDLE_LIST[m]
- for f in range(0, len(CHEWING_FINAL_LIST)):
- final = CHEWING_FINAL_LIST[f]
- chewingkey = 'ChewingKey({0}, {1}, {2})'.format(initial, middle, final)
- index = -1
- try:
- index = [x[4] for x in content_table].index(chewingkey)
- except ValueError:
- pass
-
- entry = '{0:<7} /* {1} */'.format(index, chewingkey)
- entries.append(entry)
- return ",\n".join(entries)
-
-
-### main function ###
-if __name__ == "__main__":
- print(gen_initials() + gen_middles() + gen_finals() + gen_tones())
diff --git a/scripts/correct.py b/scripts/correct.py
deleted file mode 100644
index 78403d4..0000000
--- a/scripts/correct.py
+++ /dev/null
@@ -1,129 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim:set et sts=4 sw=4:
-#
-# libzhuyin - Library to deal with zhuyin.
-#
-# Copyright (C) 2013 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.
-
-# for HSU and ETEN26
-
-hsu_correct = [
- # "correct", "wrong"
- ("ㄓ" , "ㄐ"),
- ("ㄔ" , "ㄑ"),
- ("ㄕ" , "ㄒ"),
- ("ㄛ" , "ㄏ"),
- ("ㄜ" , "ㄍ"),
- ("ㄢ" , "ㄇ"),
- ("ㄣ" , "ㄋ"),
- ("ㄤ" , "ㄎ"),
- ("ㄦ" , "ㄌ"),
- ("ㄐㄧ*" , "ㄍㄧ*"),
- ("ㄐㄩ*" , "ㄍㄩ*"),
- ("ㄓㄨ*" , "ㄐㄨ*"),
- ("ㄔㄨ*" , "ㄑㄨ*"),
- ("ㄕㄨ*" , "ㄒㄨ*"),
-# ("ㄐㄧ*" , "ㄍㄧ*"),
-# ("ㄐㄩ*" , "ㄍㄩ*"),
-]
-
-
-hsu_correct_special = [
-# "correct", "wrong"
-# ㄐㄑㄒ must follow ㄧㄩ
-# m_middle == zero from libchewing code
- ("ㄓ*" , "ㄐ*"),
- ("ㄔ*" , "ㄑ*"),
- ("ㄕ*" , "ㄒ*"),
-]
-
-
-eten26_correct = [
- # "correct", "wrong"
- ("ㄓ" , "ㄐ"),
- ("ㄕ" , "ㄒ"),
- ("ㄡ" , "ㄆ"),
- ("ㄢ" , "ㄇ"),
- ("ㄣ" , "ㄋ"),
- ("ㄤ" , "ㄊ"),
- ("ㄥ" , "ㄌ"),
- ("ㄦ" , "ㄏ"),
- ("ㄓㄨ*" , "ㄐㄨ*"),
- ("ㄕㄨ*" , "ㄒㄨ*"),
- ("ㄑㄧ*" , "ㄍㄧ*"),
- ("ㄑㄩ*" , "ㄍㄩ*"),
-]
-
-
-eten26_correct_special = [
-# "correct", "wrong"
-# ㄐㄒ must follow ㄧㄩ
-# m_middle == zero from libchewing code
- ("ㄓ*" , "ㄐ*"),
- ("ㄕ*" , "ㄒ*"),
-]
-
-
-dachen_cp26_switch = [
-# switch key, from, to
- ('q', "ㄅ", "ㄆ"),
- ('q', "ㄆ", "ㄅ"),
-
- ('w', "ㄉ", "ㄊ"),
- ('w', "ㄊ", "ㄉ"),
-
- ('t', "ㄓ", "ㄔ"),
- ('t', "ㄔ", "ㄓ"),
-
- ('i', "ㄛ", "ㄞ"),
- ('i', "ㄞ", "ㄛ"),
-
- ('o', "ㄟ", "ㄢ"),
- ('o', "ㄢ", "ㄟ"),
-
- ('l', "ㄠ", "ㄤ"),
- ('l', "ㄤ", "ㄠ"),
-
- ('p', "ㄣ", "ㄦ"),
- ('p', "ㄦ", "ㄣ"),
-]
-
-dachen_cp26_switch_special = [
-# m_initial != zero || m_middle != zero
-
- ('b', "ㄖ", "ㄝ"),
-
- ('n', "ㄙ", "ㄣ"),
-
-# switching between "ㄧ", "ㄚ", and "ㄧㄚ"
-# m_middle == 'ㄧ' and m_final != 'ㄚ'
- ('u', "ㄧ", "ㄚ"),
-# m_middle != 'ㄧ' and m_final == 'ㄚ'
- ('u', "ㄚ", "ㄧㄚ"),
-# m_middle == 'ㄧ' and m_final == "ㄚ"
- ('u', "ㄧㄚ", ""),
-# m_middle != zero
- ('u', "*?", "*ㄚ"),
-
-# switching between "ㄩ" and "ㄡ"
-# m_final != 'ㄡ'
- ('m', "ㄩ", "ㄡ"),
-# m_middle != 'ㄩ'
- ('m', "ㄡ", "ㄩ"),
-# m_middle != zero
- ('m', "*?", "*ㄡ"),
-]
diff --git a/scripts/genbopomofoheader.py b/scripts/genbopomofoheader.py
deleted file mode 100644
index ed57574..0000000
--- a/scripts/genbopomofoheader.py
+++ /dev/null
@@ -1,119 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim:set et sts=4 sw=4:
-#
-# libzhuyin - Library to deal with zhuyin.
-#
-# Copyright (c) 2010 BYVoid <byvoid1@gmail.com>
-# 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.
-
-
-from operator import itemgetter
-from utils import expand_file
-from bopomofokeyboard import *
-
-def escape_char(ch):
- if ch == "'" or ch == "\\":
- ch = "\\" + ch;
- return "'{0}'".format(ch)
-
-
-def gen_symbols(keys, symbols):
- items = []
- for (i, key) in enumerate(keys):
- items.append((key, symbols[i]))
- items = sorted(items, key=itemgetter(0))
- entries = []
- for (key, string) in items:
- key = escape_char(key)
- string = '"{0}"'.format(string)
- entry = "{{{0: <5}, {1}}}".format(key, string)
- entries.append(entry)
- entries.append("{'\\0', NULL}")
- return ",\n".join(entries)
-
-
-#generate symbols here
-def gen_chewing_symbols(scheme):
- (begin, end) = bopomofo_symbol_range
- keys = bopomofo_keyboards[scheme]
- keys = keys[begin:end]
- symbols = bopomofo_symbols[begin:end]
- return gen_symbols(keys, symbols)
-
-
-#generate initials here
-def gen_chewing_initials(scheme):
- (begin, end) = bopomofo_initial_range
- keys = bopomofo_keyboards[scheme]
- keys = keys[begin:end]
- symbols = bopomofo_symbols[begin:end]
- return gen_symbols(keys, symbols)
-
-
-#generate middles here
-def gen_chewing_middles(scheme):
- (begin, end) = bopomofo_middle_range
- keys = bopomofo_keyboards[scheme]
- keys = keys[begin:end]
- symbols = bopomofo_symbols[begin:end]
- return gen_symbols(keys, symbols)
-
-
-#generate finals here
-def gen_chewing_finals(scheme):
- (begin, end) = bopomofo_final_range
- keys = bopomofo_keyboards[scheme]
- keys = keys[begin:end]
- symbols = bopomofo_symbols[begin:end]
- return gen_symbols(keys, symbols)
-
-
-#generate tones here
-def gen_chewing_tones(scheme):
- (begin, end) = bopomofo_tone_range
- keys = bopomofo_keyboards[scheme]
- keys = keys[begin:end]
- items = []
- for (i, key) in enumerate(keys, start=1):
- items.append((key, i));
- items = sorted(items, key=itemgetter(0))
- entries = []
- for (key, tone) in items:
- key = escape_char(key);
- entry = "{{{0: <5}, {1}}}".format(key, tone)
- entries.append(entry)
- entries.append("{'\\0', 0}")
- return ",\n".join(entries)
-
-
-def get_table_content(tablename):
- (scheme, part) = tablename.split('_', 1)
- if part == "SYMBOLS":
- return gen_chewing_symbols(scheme)
- if part == "INITIALS":
- return gen_chewing_initials(scheme)
- if part == "MIDDLES":
- return gen_chewing_middles(scheme)
- if part == "FINALS":
- return gen_chewing_finals(scheme)
- if part == "TONES":
- return gen_chewing_tones(scheme)
-
-
-### main function ###
-if __name__ == "__main__":
- expand_file("chewing_table.h.in", get_table_content)
diff --git a/scripts/genchewingkey.py b/scripts/genchewingkey.py
deleted file mode 100644
index 266395c..0000000
--- a/scripts/genchewingkey.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim:set et sts=4 sw=4:
-#
-# libzhuyin - Library to deal with zhuyin.
-#
-# 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.
-
-
-from utils import expand_file
-from chewingkey import gen_initials, gen_middles, gen_finals, gen_tones
-
-
-def get_table_content(tablename):
- if tablename == 'CHEWING_INITIAL':
- return gen_initials()
- if tablename == 'CHEWING_MIDDLE':
- return gen_middles()
- if tablename == 'CHEWING_FINAL':
- return gen_finals()
- if tablename == 'CHEWING_TONE':
- return gen_tones()
-
-
-### main function ###
-if __name__ == "__main__":
- expand_file("chewing_enum.h.in", get_table_content)
-
diff --git a/scripts/genpinyinheader.py b/scripts/genpinyinheader.py
deleted file mode 100644
index d784781..0000000
--- a/scripts/genpinyinheader.py
+++ /dev/null
@@ -1,55 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim:set et sts=4 sw=4:
-#
-# libzhuyin - Library to deal with zhuyin.
-#
-# 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.
-
-
-from utils import expand_file
-from genpinyintable import gen_content_table, \
- gen_hanyu_pinyin_index, gen_luoma_pinyin_index, \
- gen_bopomofo_index, gen_secondary_bopomofo_index, \
- gen_hsu_bopomofo_index, gen_eten26_bopomofo_index, \
- gen_chewing_key_table
-
-def get_table_content(tablename):
- if tablename == 'CONTENT_TABLE':
- return gen_content_table()
- if tablename == 'HANYU_PINYIN_INDEX':
- return gen_hanyu_pinyin_index()
- if tablename == 'LUOMA_PINYIN_INDEX':
- return gen_luoma_pinyin_index()
- if tablename == 'BOPOMOFO_INDEX':
- return gen_bopomofo_index()
- if tablename == 'SECONDARY_BOPOMOFO_INDEX':
- return gen_secondary_bopomofo_index()
- if tablename == 'HSU_BOPOMOFO_INDEX':
- return gen_hsu_bopomofo_index()
- if tablename == 'ETEN26_BOPOMOFO_INDEX':
- return gen_eten26_bopomofo_index()
- if tablename == 'DIVIDED_TABLE':
- return ''
- if tablename == 'RESPLIT_TABLE':
- return ''
- if tablename == 'TABLE_INDEX':
- return gen_chewing_key_table()
-
-
-### main function ###
-if __name__ == "__main__":
- expand_file("pinyin_parser_table.h.in", get_table_content)
diff --git a/scripts/genpinyintable.py b/scripts/genpinyintable.py
deleted file mode 100644
index 63603d5..0000000
--- a/scripts/genpinyintable.py
+++ /dev/null
@@ -1,270 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim:set et sts=4 sw=4:
-#
-# libzhuyin - Library to deal with zhuyin.
-#
-# 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 operator
-import itertools
-from bopomofo import BOPOMOFO_HANYU_PINYIN_MAP, BOPOMOFO_LUOMA_PINYIN_MAP, BOPOMOFO_SECONDARY_BOPOMOFO_MAP
-from pinyintable import *
-from correct import *
-from chewingkey import gen_table_index
-from utils import shuffle_all
-
-
-content_table = []
-hanyu_pinyin_index = []
-luoma_pinyin_index = []
-bopomofo_index = []
-shuffle_bopomofo_index = []
-secondary_bopomofo_index = []
-hsu_bopomofo_index = []
-eten26_bopomofo_index = []
-
-
-#pinyin table
-def filter_pinyin_list():
- for (pinyin, bopomofo, flags, chewing) in gen_pinyin_list():
- (luoma, second) = (None, None)
-
- if bopomofo in BOPOMOFO_LUOMA_PINYIN_MAP:
- luoma = BOPOMOFO_LUOMA_PINYIN_MAP[bopomofo]
-
- if bopomofo in BOPOMOFO_SECONDARY_BOPOMOFO_MAP:
- second = BOPOMOFO_SECONDARY_BOPOMOFO_MAP[bopomofo]
-
- flags = '|'.join(flags)
- chewing = "ChewingKey({0})".format(', '.join(chewing))
- #correct = correct.replace("v", "ü")
-
- content_table.append((pinyin, bopomofo, luoma, second, chewing))
-
- if "IS_PINYIN" in flags:
- hanyu_pinyin_index.append((pinyin, flags))
- if luoma:
- luoma_pinyin_index.append((luoma, "IS_PINYIN"))
- if "IS_BOPOMOFO" in flags:
- bopomofo_index.append((bopomofo, flags))
- if second:
- secondary_bopomofo_index.append((second, "IS_PINYIN"))
-
-
-def populate_more_bopomofo_index():
- for (bopomofo, flags) in bopomofo_index:
- correct = bopomofo
- # populate hsu bopomofo index
- matches = itertools.chain(handle_rules(bopomofo, hsu_correct),
- handle_special_rules(bopomofo, hsu_correct_special))
- for wrong in matches:
- newflags = '|'.join((flags, 'HSU_CORRECT'))
- hsu_bopomofo_index.append((wrong, newflags, correct))
-
- # populate eten26 bopomofo index
- matches = itertools.chain(handle_rules(bopomofo, eten26_correct),
- handle_special_rules(bopomofo, eten26_correct_special))
- for wrong in matches:
- newflags = '|'.join((flags, 'ETEN26_CORRECT'))
- eten26_bopomofo_index.append((wrong, newflags, correct))
-
- for (bopomofo, flags) in bopomofo_index:
- correct = bopomofo
- # remove duplicate items
- if bopomofo not in [x[0] for x in hsu_bopomofo_index]:
- hsu_bopomofo_index.append((bopomofo, flags, correct))
-
- if bopomofo not in [x[0] for x in eten26_bopomofo_index]:
- eten26_bopomofo_index.append((bopomofo, flags, correct))
-
- # populate shuffled bopomofo index
- for (bopomofo, flags) in bopomofo_index:
- correct = bopomofo
- shuffle_bopomofo_index.append((bopomofo, flags, correct))
- newflags = '|'.join((flags, 'SHUFFLE_CORRECT'))
- for shuffle in shuffle_all(bopomofo):
- assert shuffle not in [x[0] for x in shuffle_bopomofo_index]
- shuffle_bopomofo_index.append((shuffle, newflags, correct))
-
-
-def sort_all():
- global content_table, hanyu_pinyin_index, luoma_pinyin_index
- global bopomofo_index, shuffle_bopomofo_index, secondary_bopomofo_index
- global hsu_bopomofo_index, eten26_bopomofo_index
-
- #remove duplicates
- content_table = list(set(content_table))
- hanyu_pinyin_index = list(set(hanyu_pinyin_index))
- luoma_pinyin_index = list(set(luoma_pinyin_index))
- bopomofo_index = list(set(bopomofo_index))
- shuffle_bopomofo_index = list(set(shuffle_bopomofo_index))
- secondary_bopomofo_index = list(set(secondary_bopomofo_index))
- hsu_bopomofo_index = list(set(hsu_bopomofo_index))
- eten26_bopomofo_index = list(set(eten26_bopomofo_index))
-
- #define sort function
- sortfunc = operator.itemgetter(0)
- #begin sort
- content_table = sorted(content_table, key=sortfunc)
- #prepend zero item to reserve the invalid item
- content_table.insert(0, ("", "", "", "", "ChewingKey()"))
- #sort index
- hanyu_pinyin_index = sorted(hanyu_pinyin_index, key=sortfunc)
- luoma_pinyin_index = sorted(luoma_pinyin_index, key=sortfunc)
- bopomofo_index = sorted(bopomofo_index, key=sortfunc)
- shuffle_bopomofo_index = sorted(shuffle_bopomofo_index, key=sortfunc)
- secondary_bopomofo_index = sorted(secondary_bopomofo_index, key=sortfunc)
- hsu_bopomofo_index = sorted(hsu_bopomofo_index, key=sortfunc)
- eten26_bopomofo_index = sorted(eten26_bopomofo_index, key=sortfunc)
-
-'''
-def get_sheng_yun(pinyin):
- if pinyin == None:
- return None, None
- if pinyin == "":
- return "", ""
- if pinyin == "ng":
- return "", "ng"
- for i in range(2, 0, -1):
- s = pinyin[:i]
- if s in shengmu_list:
- return s, pinyin[i:]
- return "", pinyin
-'''
-
-def gen_content_table():
- entries = []
- for ((pinyin, bopomofo, luoma, second, chewing)) in content_table:
- entry = '{{"{0}", "{1}", "{2}", "{3}" ,{4}}}'.format(pinyin, bopomofo, luoma, second, chewing)
- entries.append(entry)
- return ',\n'.join(entries)
-
-
-def gen_hanyu_pinyin_index():
- entries = []
- for (pinyin, flags) in hanyu_pinyin_index:
- index = [x[0] for x in content_table].index(pinyin)
- entry = '{{"{0}", {1}, {2}}}'.format(pinyin, flags, index)
- entries.append(entry)
- return ',\n'.join(entries)
-
-def gen_luoma_pinyin_index():
- entries = []
- for (pinyin, flags) in luoma_pinyin_index:
- index = [x[2] for x in content_table].index(pinyin)
- entry = '{{"{0}", {1}, {2}}}'.format(pinyin, flags, index)
- entries.append(entry)
- return ',\n'.join(entries)
-
-def gen_bopomofo_index():
- entries = []
- for (shuffle, flags, correct) in shuffle_bopomofo_index:
- pinyin = BOPOMOFO_HANYU_PINYIN_MAP[correct]
- index = [x[0] for x in content_table].index(pinyin)
- entry = '{{"{0}", {1}, {2}}}'.format(shuffle, flags, index)
- entries.append(entry)
- return ',\n'.join(entries)
-
-def gen_secondary_bopomofo_index():
- entries = []
- for (bopomofo, flags) in secondary_bopomofo_index:
- index = [x[3] for x in content_table].index(bopomofo)
- entry = '{{"{0}", {1}, {2}}}'.format(bopomofo, flags, index)
- entries.append(entry)
- return ',\n'.join(entries)
-
-def gen_hsu_bopomofo_index():
- entries = []
- for (wrong, flags, correct) in hsu_bopomofo_index:
- pinyin = BOPOMOFO_HANYU_PINYIN_MAP[correct]
- index = [x[0] for x in content_table].index(pinyin)
- entry = '{{"{0}" /* "{1}" */, {2}, {3}}}'.format \
- (wrong, pinyin, flags, index)
- entries.append(entry)
- return ',\n'.join(entries)
-
-def gen_eten26_bopomofo_index():
- entries = []
- for (wrong, flags, correct) in eten26_bopomofo_index:
- pinyin = BOPOMOFO_HANYU_PINYIN_MAP[correct]
- index = [x[0] for x in content_table].index(pinyin)
- entry = '{{"{0}" /* "{1}" */, {2}, {3}}}'.format \
- (wrong, pinyin, flags, index)
- entries.append(entry)
- return ',\n'.join(entries)
-
-def check_rule(correct, wrong):
- if '*' not in correct:
- assert '*' not in wrong
- elif correct.endswith('*'):
- assert wrong.endswith('*')
- else:
- assert False, "unknown rule format"
- return True
-
-def check_rules(rules, specials):
- for (correct, wrong) in rules:
- check_rule(correct, wrong)
- for (correct, wrong) in specials:
- assert '*' in correct
- check_rule(correct, wrong)
-
-def handle_rules(bopomofo, corrects):
- matches = []
- for (correct, wrong) in corrects:
- if '*' not in correct:
- if correct == bopomofo:
- matches.append(wrong)
- elif correct.endswith('*'):
- starts = correct[0:-1]
- if bopomofo.startswith(starts):
- remained = bopomofo[len(starts):]
- newstr = wrong[0:-1] + remained
- matches.append(newstr)
- return matches
-
-def handle_special_rules(bopomofo, corrects):
-# special rules require additional check m_middle == zero
- matches = []
- if 'ㄧ' in bopomofo:
- return matches
- if 'ㄨ' in bopomofo:
- return matches
- if 'ㄩ' in bopomofo:
- return matches
-# Note: special rules always contains '*'
- return handle_rules(bopomofo, corrects)
-
-def gen_chewing_key_table():
- return gen_table_index(content_table)
-
-
-#init code
-filter_pinyin_list()
-check_rules(hsu_correct, hsu_correct_special)
-check_rules(eten26_correct, eten26_correct_special)
-populate_more_bopomofo_index()
-sort_all()
-
-
-### main function ###
-if __name__ == "__main__":
- #s = gen_content_table() + gen_hanyu_pinyin_index() + gen_bopomofo_index()
- #s = gen_content_table() + gen_luoma_pinyin_index() + gen_secondary_bopomofo_index()
- s = gen_hsu_bopomofo_index() + gen_eten26_bopomofo_index()
- #s = gen_chewing_key_table()
- print(s)
diff --git a/scripts/pinyin.py b/scripts/pinyin.py
deleted file mode 100644
index 8861b60..0000000
--- a/scripts/pinyin.py
+++ /dev/null
@@ -1,167 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim:set et sts=4 sw=4:
-#
-# libzhuyin - Library to deal with zhuyin.
-#
-# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
-# 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.
-
-N_ = lambda x : x
-HANYU_PINYIN_DICT = {
- "a" : 1, "ai" : 2, "an" : 3, "ang" : 4, "ao" : 5,
- "ba" : 6, "bai" : 7, "ban" : 8, "bang" : 9, "bao" : 10,
- "bei" : 11, "ben" : 12, "beng" : 13, "bi" : 14, "bian" : 15,
- "biao" : 16, "bie" : 17, "bin" : 18, "bing" : 19, "bo" : 20,
- "bu" : 21, "ca" : 22, "cai" : 23, "can" : 24, "cang" : 25,
- "cao" : 26, "ce" : 27, "cen" : 28, "ceng" : 29, "ci" : 30,
- "cong" : 31, "cou" : 32, "cu" : 33, "cuan" : 34, "cui" : 35,
- "cun" : 36, "cuo" : 37, "cha" : 38, "chai" : 39, "chan" : 40,
- "chang" : 41, "chao" : 42, "che" : 43, "chen" : 44, "cheng" : 45,
- "chi" : 46, "chong" : 47, "chou" : 48, "chu" : 49, "chuai" : 50,
- "chuan" : 51, "chuang" : 52, "chui" : 53, "chun" : 54, "chuo" : 55,
- "da" : 56, "dai" : 57, "dan" : 58, "dang" : 59, "dao" : 60,
- "de" : 61, "dei" : 62,
- # "den" : 63,
- "deng" : 64, "di" : 65,
- "dia" : 66, "dian" : 67, "diao" : 68, "die" : 69, "ding" : 70,
- "diu" : 71, "dong" : 72, "dou" : 73, "du" : 74, "duan" : 75,
- "dui" : 76, "dun" : 77, "duo" : 78, "e" : 79, "ei" : 80,
- "en" : 81, "er" : 82, "fa" : 83, "fan" : 84, "fang" : 85,
- "fei" : 86, "fen" : 87, "feng" : 88, "fo" : 89, "fou" : 90,
- "fu" : 91, "ga" : 92, "gai" : 93, "gan" : 94, "gang" : 95,
- "gao" : 96, "ge" : 97, "gei" : 98, "gen" : 99, "geng" : 100,
- "gong" : 101, "gou" : 102, "gu" : 103, "gua" : 104, "guai" : 105,
- "guan" : 106, "guang" : 107, "gui" : 108, "gun" : 109, "guo" : 110,
- "ha" : 111, "hai" : 112, "han" : 113, "hang" : 114, "hao" : 115,
- "he" : 116, "hei" : 117, "hen" : 118, "heng" : 119, "hong" : 120,
- "hou" : 121, "hu" : 122, "hua" : 123, "huai" : 124, "huan" : 125,
- "huang" : 126, "hui" : 127, "hun" : 128, "huo" : 129, "ji" : 130,
- "jia" : 131, "jian" : 132, "jiang" : 133, "jiao" : 134, "jie" : 135,
- "jin" : 136, "jing" : 137, "jiong" : 138, "jiu" : 139, "ju" : 140,
- "juan" : 141, "jue" : 142, "jun" : 143, "ka" : 144, "kai" : 145,
- "kan" : 146, "kang" : 147, "kao" : 148, "ke" : 149,
- # "kei" : 150,
- "ken" : 151, "keng" : 152, "kong" : 153, "kou" : 154, "ku" : 155,
- "kua" : 156, "kuai" : 157, "kuan" : 158, "kuang" : 159, "kui" : 160,
- "kun" : 161, "kuo" : 162, "la" : 163, "lai" : 164, "lan" : 165,
- "lang" : 166, "lao" : 167, "le" : 168, "lei" : 169, "leng" : 170,
- "li" : 171, "lia" : 172, "lian" : 173, "liang" : 174, "liao" : 175,
- "lie" : 176, "lin" : 177, "ling" : 178, "liu" : 179,
- "lo" : 180,
- "long" : 181, "lou" : 182, "lu" : 183, "luan" : 184,
- # "lue" : 185,
- "lun" : 186, "luo" : 187, "lv" : 188, "lve" : 189,
- "ma" : 190,
- "mai" : 191, "man" : 192, "mang" : 193, "mao" : 194, "me" : 195,
- "mei" : 196, "men" : 197, "meng" : 198, "mi" : 199, "mian" : 200,
- "miao" : 201, "mie" : 202, "min" : 203, "ming" : 204, "miu" : 205,
- "mo" : 206, "mou" : 207, "mu" : 208, "na" : 209, "nai" : 210,
- "nan" : 211, "nang" : 212, "nao" : 213, "ne" : 214, "nei" : 215,
- "nen" : 216, "neng" : 217, "ni" : 218, "nian" : 219, "niang" : 220,
- "niao" : 221, "nie" : 222, "nin" : 223, "ning" : 224, "niu" : 225,
- "ng" : 226,
- "nong" : 227, "nou" : 228, "nu" : 229, "nuan" : 230,
- # "nue" : 231,
- "nuo" : 232, "nv" : 233, "nve" : 234,
- "o" : 235,
- "ou" : 236, "pa" : 237, "pai" : 238, "pan" : 239, "pang" : 240,
- "pao" : 241, "pei" : 242, "pen" : 243, "peng" : 244, "pi" : 245,
- "pian" : 246, "piao" : 247, "pie" : 248, "pin" : 249, "ping" : 250,
- "po" : 251, "pou" : 252, "pu" : 253, "qi" : 254, "qia" : 255,
- "qian" : 256, "qiang" : 257, "qiao" : 258, "qie" : 259, "qin" : 260,
- "qing" : 261, "qiong" : 262, "qiu" : 263, "qu" : 264, "quan" : 265,
- "que" : 266, "qun" : 267, "ran" : 268, "rang" : 269, "rao" : 270,
- "re" : 271, "ren" : 272, "reng" : 273, "ri" : 274, "rong" : 275,
- "rou" : 276, "ru" : 277, "ruan" : 278, "rui" : 279, "run" : 280,
- "ruo" : 281, "sa" : 282, "sai" : 283, "san" : 284, "sang" : 285,
- "sao" : 286, "se" : 287, "sen" : 288, "seng" : 289, "si" : 290,
- "song" : 291, "sou" : 292, "su" : 293, "suan" : 294, "sui" : 295,
- "sun" : 296, "suo" : 297, "sha" : 298, "shai" : 299, "shan" : 300,
- "shang" : 301, "shao" : 302, "she" : 303, "shei" : 304, "shen" : 305,
- "sheng" : 306, "shi" : 307, "shou" : 308, "shu" : 309, "shua" : 310,
- "shuai" : 311, "shuan" : 312, "shuang" : 313, "shui" : 314, "shun" : 315,
- "shuo" : 316, "ta" : 317, "tai" : 318, "tan" : 319, "tang" : 320,
- "tao" : 321, "te" : 322,
- # "tei" : 323,
- "teng" : 324, "ti" : 325,
- "tian" : 326, "tiao" : 327, "tie" : 328, "ting" : 329, "tong" : 330,
- "tou" : 331, "tu" : 332, "tuan" : 333, "tui" : 334, "tun" : 335,
- "tuo" : 336, "wa" : 337, "wai" : 338, "wan" : 339, "wang" : 340,
- "wei" : 341, "wen" : 342, "weng" : 343, "wo" : 344, "wu" : 345,
- "xi" : 346, "xia" : 347, "xian" : 348, "xiang" : 349, "xiao" : 350,
- "xie" : 351, "xin" : 352, "xing" : 353, "xiong" : 354, "xiu" : 355,
- "xu" : 356, "xuan" : 357, "xue" : 358, "xun" : 359, "ya" : 360,
- "yan" : 361, "yang" : 362, "yao" : 363, "ye" : 364, "yi" : 365,
- "yin" : 366, "ying" : 367, "yo" : 368, "yong" : 369, "you" : 370,
- "yu" : 371, "yuan" : 372, "yue" : 373, "yun" : 374, "za" : 375,
- "zai" : 376, "zan" : 377, "zang" : 378, "zao" : 379, "ze" : 380,
- "zei" : 381, "zen" : 382, "zeng" : 383, "zi" : 384, "zong" : 385,
- "zou" : 386, "zu" : 387, "zuan" : 388, "zui" : 389, "zun" : 390,
- "zuo" : 391, "zha" : 392, "zhai" : 393, "zhan" : 394, "zhang" : 395,
- "zhao" : 396, "zhe" : 397, "zhen" : 398, "zheng" : 399, "zhi" : 400,
- "zhong" : 401, "zhou" : 402, "zhu" : 403, "zhua" : 404, "zhuai" : 405,
- "zhuan" : 406, "zhuang" : 407, "zhui" : 408, "zhun" : 409, "zhuo" : 410,
- # some weird pinyins
- #~ "eng" : 411, "chua" : 412, "fe" : 413, "fiao" : 414, "liong" : 415
-}
-
-HANYU_PINYIN_LIST = HANYU_PINYIN_DICT.keys ()
-
-
-SHENGMU_DICT = {
- "b" : 1, "p" : 2, "m" : 3, "f" : 4, "d" : 5,
- "t" : 6, "n" : 7, "l" : 8, "g" : 9, "k" : 10, "h" : 11,
- "j" : 12, "q" : 13, "x" : 14, "zh" : 15, "ch" : 16, "sh" : 17,
- "r" : 18, "z" : 19, "c" : 20, "s" : 21, "y" : 22, "w" : 23
-}
-
-SHENGMU_LIST = SHENGMU_DICT.keys ()
-
-
-YUNMU_DICT = {
- "a" : 1, "ai" : 2, "an" : 3, "ang" : 4, "ao" : 5,
- "e" : 6, "ei" : 7, "en" : 8, "eng" : 9, "er" : 10,
- "i" : 11, "ia" : 12, "ian" : 13, "iang" : 14, "iao" : 15,
- "ie" : 16, "in" : 17, "ing" : 18, "iong" : 19, "iu" : 20,
- "o" : 21, "ong" : 22, "ou" : 23, "u" : 24, "ua" : 25,
- "uai" : 26, "uan" : 27, "uang" : 28, "ue" : 29, "ui" : 30,
- "un" : 31, "uo" : 32, "v" : 33, "ve" : 34
-}
-
-YUNMU_LIST = YUNMU_DICT.keys ()
-
-
-MOHU_SHENGMU = {
- "z" : ("z", "zh"),
- "zh" : ("z", "zh"),
- "c" : ("c", "ch"),
- "ch" : ("c", "ch"),
- "s" : ("s", "sh"),
- "sh" : ("s", "sh"),
- "l" : ("l", "n"),
- "n" : ("l", "n")
-}
-
-MOHU_YUNMU = {
- "an" : ("an", "ang"),
- "ang" : ("an", "ang"),
- "en" : ("en", "eng"),
- "eng" : ("en", "eng"),
- "in" : ("in", "ing"),
- "ing" : ("in", "ing")
-}
-
diff --git a/scripts/pinyin_parser_table.h.in b/scripts/pinyin_parser_table.h.in
deleted file mode 100644
index ef183f8..0000000
--- a/scripts/pinyin_parser_table.h.in
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef PINYIN_PARSER_TABLE_H
-#define PINYIN_PARSER_TABLE_H
-
-namespace zhuyin{
-
-const pinyin_index_item_t hanyu_pinyin_index[] = {
-@HANYU_PINYIN_INDEX@
-};
-
-const pinyin_index_item_t luoma_pinyin_index[] = {
-@LUOMA_PINYIN_INDEX@
-};
-
-const chewing_index_item_t bopomofo_index[] = {
-@BOPOMOFO_INDEX@
-};
-
-const pinyin_index_item_t secondary_bopomofo_index[] = {
-@SECONDARY_BOPOMOFO_INDEX@
-};
-
-const chewing_index_item_t hsu_bopomofo_index[] = {
-@HSU_BOPOMOFO_INDEX@
-};
-
-const chewing_index_item_t eten26_bopomofo_index[] = {
-@ETEN26_BOPOMOFO_INDEX@
-};
-
-const content_table_item_t content_table[] = {
-@CONTENT_TABLE@
-};
-
-#if 0
-const divided_table_item_t divided_table[] = {
-@DIVIDED_TABLE@
-};
-
-const resplit_table_item_t resplit_table[] = {
-@RESPLIT_TABLE@
-};
-#endif
-
-const gint chewing_key_table[CHEWING_NUMBER_OF_INITIALS *
- CHEWING_NUMBER_OF_MIDDLES *
- CHEWING_NUMBER_OF_FINALS] = {
-@TABLE_INDEX@
-};
-
-};
-
-#endif
diff --git a/scripts/pinyintable.py b/scripts/pinyintable.py
deleted file mode 100644
index c466a28..0000000
--- a/scripts/pinyintable.py
+++ /dev/null
@@ -1,143 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim:set et sts=4 sw=4:
-#
-# libzhuyin - Library to deal with zhuyin.
-#
-# 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
-import bopomofo
-import chewing
-import itertools
-
-
-pinyin_list = sorted(bopomofo.HANYU_PINYIN_BOPOMOFO_MAP.keys())
-shengmu_list = sorted(pinyin.SHENGMU_LIST)
-
-
-def check_pinyin_chewing_map():
- for pinyin_key in pinyin.HANYU_PINYIN_DICT.keys():
- if pinyin_key in pinyin_list:
- pass
- else:
- print("pinyin %s has no chewing mapping", pinyin_key)
-
-
-def get_chewing(pinyin_key):
- initial, middle, final = \
- 'CHEWING_ZERO_INITIAL', 'CHEWING_ZERO_MIDDLE', 'CHEWING_ZERO_FINAL'
- assert pinyin_key != None
- assert pinyin_key in bopomofo.HANYU_PINYIN_BOPOMOFO_MAP
-
- #handle 'w' and 'y'
- if pinyin_key[0] == 'w':
- initial = 'PINYIN_W'
- if pinyin_key[0] == 'y':
- initial = 'PINYIN_Y'
-
- #get chewing string
- bopomofo_str = bopomofo.HANYU_PINYIN_BOPOMOFO_MAP[pinyin_key]
-
- #handle bopomofo SPECIAL_INITIAL_SET
- if pinyin_key in bopomofo.SPECIAL_INITIAL_SET:
- middle = "CHEWING_I"
- #normal process
- for char in bopomofo_str:
- if char in chewing.CHEWING_ASCII_INITIAL_MAP:
- initial = chewing.CHEWING_ASCII_INITIAL_MAP[char]
- if char in chewing.CHEWING_ASCII_MIDDLE_MAP:
- middle = chewing.CHEWING_ASCII_MIDDLE_MAP[char]
- if char in chewing.CHEWING_ASCII_FINAL_MAP:
- final = chewing.CHEWING_ASCII_FINAL_MAP[char]
- if char == "ㄜ": # merge "ㄝ" and "ㄜ"
- final = "CHEWING_E"
-
- 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"),
- }
-
- if (middle, final) in post_process_rules:
- (middle, final) = post_process_rules[(middle, final)]
-
- return initial, middle, final
-
-
-def gen_pinyin_list():
- for p in itertools.chain(gen_pinyins(),
- gen_shengmu(),
- ):
- yield p
-
-
-def gen_pinyins():
- #generate all pinyins in bopomofo
- for pinyin_key in pinyin_list:
- flags = []
- if pinyin_key in bopomofo.HANYU_PINYIN_BOPOMOFO_MAP.keys():
- flags.append("IS_BOPOMOFO")
- if pinyin_key in pinyin.HANYU_PINYIN_LIST or \
- pinyin_key in pinyin.SHENGMU_LIST:
- flags.append("IS_PINYIN")
- if pinyin_key in shengmu_list:
- flags.append("PINYIN_INCOMPLETE")
- chewing_key = bopomofo.HANYU_PINYIN_BOPOMOFO_MAP[pinyin_key]
- if chewing_key in chewing.CHEWING_ASCII_INITIAL_MAP and \
- pinyin_key not in bopomofo.SPECIAL_INITIAL_SET:
- flags.append("CHEWING_INCOMPLETE")
- yield pinyin_key, chewing_key, \
- flags, get_chewing(pinyin_key)
-
-
-def get_shengmu_chewing(shengmu):
- assert shengmu in shengmu_list, "Expected shengmu here."
- chewing_key = 'CHEWING_{0}'.format(shengmu.upper())
- if chewing_key in chewing.ASCII_CHEWING_INITIAL_MAP:
- initial = chewing_key
- else:
- initial = 'PINYIN_{0}'.format(shengmu.upper())
- return initial, "CHEWING_ZERO_MIDDLE", "CHEWING_ZERO_FINAL"
-
-def gen_shengmu():
- #generate all shengmu
- for shengmu in shengmu_list:
- if shengmu in pinyin_list:
- continue
- flags = ["IS_PINYIN", "PINYIN_INCOMPLETE"]
- chewing_key = get_shengmu_chewing(shengmu)
- chewing_initial = chewing_key[0]
- if chewing_initial in chewing.ASCII_CHEWING_INITIAL_MAP:
- chewing_initial = chewing.ASCII_CHEWING_INITIAL_MAP[chewing_initial]
- yield shengmu, chewing_initial, \
- flags, chewing_key
-
-
-
-### main function ###
-if __name__ == "__main__":
- #pre-check here
- check_pinyin_chewing_map()
-
- #dump
- for p in gen_pinyin_list():
- print (p)
diff --git a/scripts/utils.py b/scripts/utils.py
deleted file mode 100644
index f3e46c5..0000000
--- a/scripts/utils.py
+++ /dev/null
@@ -1,65 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim:set et sts=4 sw=4:
-#
-# libzhuyin - Library to deal with zhuyin.
-#
-# 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 os
-
-header = '''/* This file is generated by python scripts. Don't edit this file directly.
- */
-'''
-
-
-def expand_file(filename, get_table_content):
- infile = open(filename, "r")
- print(header)
- for line in infile.readlines():
- line = line.rstrip(os.linesep)
- if len(line) < 3:
- print(line)
- continue
- if line[0] == '@' and line[-1] == '@':
- tablename = line[1:-1]
- print(get_table_content(tablename))
- else:
- print(line)
-
-
-def shuffle_all(instr):
- for output in shuffle_recur(instr):
- if output == instr:
- continue
- yield output
-
-
-def shuffle_recur(instr):
- if len(instr) == 1:
- yield instr
- else:
- for i, ch in enumerate(instr):
- recur = instr[:i] + instr[i+1:]
- for s in shuffle_recur(recur):
- yield ch + s
-
-
-if __name__ == "__main__":
- for s in shuffle_all("abc"):
- print(s)