handle tone in gen special table
authorPeng Wu <alexepico@gmail.com>
Sun, 30 Oct 2011 08:36:44 +0000 (16:36 +0800)
committerPeng Wu <alexepico@gmail.com>
Sun, 30 Oct 2011 08:36:44 +0000 (16:36 +0800)
scripts/genspecialtable.py

index bb3f061..4315087 100644 (file)
@@ -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)