summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-11-02 12:07:02 +0800
committerPeng Wu <alexepico@gmail.com>2011-11-02 12:07:02 +0800
commitd894cf14145e54d934d0490aae80bfb8c7aafb79 (patch)
tree566ae3857c0ecbc3efec26547a7b3f3cd92ae7a7
parentc25fd787f6d4c20236ff8488f21891dc82b78749 (diff)
downloadlibpinyin-d894cf14145e54d934d0490aae80bfb8c7aafb79.tar.gz
libpinyin-d894cf14145e54d934d0490aae80bfb8c7aafb79.tar.xz
libpinyin-d894cf14145e54d934d0490aae80bfb8c7aafb79.zip
write pinyin_parser_table.h.in
-rw-r--r--scripts/genspecialtable.py8
-rw-r--r--scripts/pinyin_parser_table.h.in17
2 files changed, 21 insertions, 4 deletions
diff --git a/scripts/genspecialtable.py b/scripts/genspecialtable.py
index 4315087..928ca9e 100644
--- a/scripts/genspecialtable.py
+++ b/scripts/genspecialtable.py
@@ -71,7 +71,7 @@ def filter_divided():
yield pinyin_key, first_key, second_key, freq
-def gen_all_special():
+def gen_all_resplit():
for pinyin_key in pinyin_list:
if pinyin_key[-1] in ["n", "g", "r"]:
for yun in yunmu_list:
@@ -84,9 +84,9 @@ def gen_all_special():
yield pinyin_key, "r", pinyin_key[:-1], "er"
-def filter_special():
+def filter_resplit():
for (orig_first_key, orig_second_key, new_first_key, new_second_key) \
- in gen_all_special():
+ in gen_all_resplit():
if not (new_first_key, new_second_key) in phrase_dict:
continue
orig_freq = 0
@@ -101,5 +101,5 @@ if __name__ == "__main__":
load_phrase("pinyin2.txt")
for p in filter_divided():
print (p)
- for p in filter_special():
+ for p in filter_resplit():
print (p)
diff --git a/scripts/pinyin_parser_table.h.in b/scripts/pinyin_parser_table.h.in
new file mode 100644
index 0000000..8bb7bb8
--- /dev/null
+++ b/scripts/pinyin_parser_table.h.in
@@ -0,0 +1,17 @@
+/* This file is generated by python scripts. Don't edit this file directly.
+ */
+
+#ifndef PINYIN_PARSER_TABLE_H
+#define PINYIN_PARSER_TABLE_H
+
+@PINYIN_INDEX@
+
+@BOPOMOFO_INDEX@
+
+@CONTENT_TABLE@
+
+@DIVIDED_TABLE@
+
+@RESPLIT_TABLE@
+
+#endif