summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-10-30 16:36:44 +0800
committerPeng Wu <alexepico@gmail.com>2011-10-30 16:36:44 +0800
commit600255c235047ae8972d3474e402d69282f602c0 (patch)
tree850348e1d5fe53e8f44696b183b5d466a92124a2 /scripts
parent85a934c958a036d17b548919d2264825eae8a68b (diff)
downloadlibpinyin-600255c235047ae8972d3474e402d69282f602c0.tar.gz
libpinyin-600255c235047ae8972d3474e402d69282f602c0.tar.xz
libpinyin-600255c235047ae8972d3474e402d69282f602c0.zip
handle tone in gen special table
Diffstat (limited to 'scripts')
-rw-r--r--scripts/genspecialtable.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/scripts/genspecialtable.py b/scripts/genspecialtable.py
index bb3f061..4315087 100644
--- a/scripts/genspecialtable.py
+++ b/scripts/genspecialtable.py
@@ -41,7 +41,12 @@ def load_phrase(filename):
if 0 == freq:
#print(pinyin_str)
continue
+
(first_key, second_key) = pinyin_str.split("'")
+ if first_key[-1].isdigit():
+ first_key = first_key[:-1]
+ if second_key[-1].isdigit():
+ second_key = second_key[:-1]
phrase_dict[(first_key, second_key)] = freq
phrasefile.close()
@@ -94,5 +99,7 @@ def filter_special():
if __name__ == "__main__":
load_phrase("pinyin2.txt")
+ for p in filter_divided():
+ print (p)
for p in filter_special():
print (p)