summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-11-09 13:21:57 +0800
committerPeng Wu <alexepico@gmail.com>2011-11-09 13:21:57 +0800
commit0862e20f358e93957a4f5cb10b571d015f33fa96 (patch)
tree2fff91799d3f0cb4dcd156446cb6195cb3db681d
parent4fbe19e5eaeb4d1bdb509daafeedbf923438b1b7 (diff)
downloadlibpinyin-0862e20f358e93957a4f5cb10b571d015f33fa96.tar.gz
libpinyin-0862e20f358e93957a4f5cb10b571d015f33fa96.tar.xz
libpinyin-0862e20f358e93957a4f5cb10b571d015f33fa96.zip
add genpinyin2.awk
-rw-r--r--scripts/Makefile.data9
-rw-r--r--scripts/genpinyin2.awk8
2 files changed, 17 insertions, 0 deletions
diff --git a/scripts/Makefile.data b/scripts/Makefile.data
new file mode 100644
index 0000000..2f665b2
--- /dev/null
+++ b/scripts/Makefile.data
@@ -0,0 +1,9 @@
+all: pinyin2.txt
+
+
+pinyin2.txt:
+ awk -f genpinyin2.awk ../data/gb_char.table > $@
+
+
+.PHONY: pinyin2.txt
+
diff --git a/scripts/genpinyin2.awk b/scripts/genpinyin2.awk
new file mode 100644
index 0000000..00c6cad
--- /dev/null
+++ b/scripts/genpinyin2.awk
@@ -0,0 +1,8 @@
+#!/usr/bin/awk
+ { if (length($2) == 2) pinyins[$1] += $4 }
+
+END {
+ for (pinyin in pinyins) {
+ print pinyin, pinyins[pinyin]
+ }
+}