summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-11-21 16:22:03 +0800
committerPeng Wu <alexepico@gmail.com>2011-11-21 16:22:33 +0800
commit9f402d3b11ccc24ceaf461048c6d5adcc0a4f7ce (patch)
tree1ff1479f1998c379f26ae9bfa4e31cbffe5543f8 /scripts
parentb502f9eb3d61967662407ccaa2d3f08de9592d50 (diff)
downloadlibpinyin-9f402d3b11ccc24ceaf461048c6d5adcc0a4f7ce.tar.gz
libpinyin-9f402d3b11ccc24ceaf461048c6d5adcc0a4f7ce.tar.xz
libpinyin-9f402d3b11ccc24ceaf461048c6d5adcc0a4f7ce.zip
add genbopomofoheader.py
Diffstat (limited to 'scripts')
-rw-r--r--scripts/bopomofo.py12
-rw-r--r--scripts/genbopomofoheader.py63
2 files changed, 63 insertions, 12 deletions
diff --git a/scripts/bopomofo.py b/scripts/bopomofo.py
index bd0f448..09a7b88 100644
--- a/scripts/bopomofo.py
+++ b/scripts/bopomofo.py
@@ -21,18 +21,6 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-'''
-const static gunichar bopomofo_char[] = {
- L'\0',L'ㄅ',L'ㄆ',L'ㄇ',L'ㄈ',L'ㄉ',L'ㄊ',L'ㄋ',L'ㄌ',L'ㄍ',L'ㄎ',
- L'ㄏ',L'ㄐ',L'ㄑ',L'ㄒ',L'ㄓ',L'ㄔ',L'ㄕ',L'ㄖ',L'ㄗ',L'ㄘ',L'ㄙ',
-
- L'ㄧ',L'ㄨ',L'ㄩ',L'ㄚ',L'ㄛ',L'ㄜ',L'ㄝ',L'ㄞ',L'ㄟ',L'ㄠ',L'ㄡ',
- L'ㄢ',L'ㄣ',L'ㄤ',L'ㄥ',L'ㄦ',
-
- L'ˊ',L'ˇ',L'ˋ',L'˙',
-};
-'''
-
BOPOMOFO_PINYIN_MAP = {
"ㄅ" : "b",
"ㄅㄚ" : "ba",
diff --git a/scripts/genbopomofoheader.py b/scripts/genbopomofoheader.py
new file mode 100644
index 0000000..e13e58d
--- /dev/null
+++ b/scripts/genbopomofoheader.py
@@ -0,0 +1,63 @@
+# -*- coding: utf-8 -*-
+# vim:set et sts=4 sw=4:
+#
+# libpinyin - Library to deal with pinyin.
+#
+# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+
+bopomofo = [
+ 'NULL', 'ㄅ', 'ㄆ', 'ㄇ', 'ㄈ', 'ㄉ', 'ㄊ', 'ㄋ', 'ㄌ', 'ㄍ', 'ㄎ',
+ 'ㄏ', 'ㄐ', 'ㄑ', 'ㄒ', 'ㄓ', 'ㄔ', 'ㄕ', 'ㄖ', 'ㄗ', 'ㄘ', 'ㄙ',
+
+ 'ㄧ', 'ㄨ', 'ㄩ', 'ㄚ', 'ㄛ', 'ㄜ', 'ㄝ', 'ㄞ', 'ㄟ', 'ㄠ', 'ㄡ',
+ 'ㄢ', 'ㄣ', 'ㄤ', 'ㄥ', 'ㄦ',
+
+ 'ˊ', 'ˇ', 'ˋ', '˙',
+]
+
+bopomofo_keyboard = (
+ #標準注音鍵盤
+ (
+ "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",
+ ),
+ #精業注音鍵盤
+ (
+ "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",
+ ),
+ #倚天注音鍵盤
+ (
+ "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注音鍵盤
+ (
+ "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",",",".","/",
+ ),
+)
+
+
+if __name__ == "__main__":
+ pass