summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-01-10 15:30:26 +0800
committerPeng Wu <alexepico@gmail.com>2012-01-10 15:30:26 +0800
commit54ad235d3ca42925a84c1daa7540c7f5d41cf216 (patch)
tree1eacaf71381dd7d0618dcf8ccc662f223b75c46c
parentfabe3b1fd6b6ccab4f9f8b606a8503aee08c738d (diff)
downloadlibpinyin-54ad235d3ca42925a84c1daa7540c7f5d41cf216.tar.gz
libpinyin-54ad235d3ca42925a84c1daa7540c7f5d41cf216.tar.xz
libpinyin-54ad235d3ca42925a84c1daa7540c7f5d41cf216.zip
fixes specialtable.py
-rw-r--r--scripts/specialtable.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/specialtable.py b/scripts/specialtable.py
index 9f03904..41f9a26 100644
--- a/scripts/specialtable.py
+++ b/scripts/specialtable.py
@@ -48,11 +48,17 @@ def load_phrase(filename):
first_key = first_key[:-1]
if second_key[-1].isdigit():
second_key = second_key[:-1]
- phrase_dict[(first_key, second_key)] = freq
+ if (first_key, second_key) in phrase_dict:
+ phrase_dict[(first_key, second_key)] += freq
+ else:
+ phrase_dict[(first_key, second_key)] = freq
else:
if pinyin_str[-1].isdigit():
pinyin_str = pinyin_str[:-1]
- phrase_dict[pinyin_str] = freq
+ if pinyin_str in phrase_dict:
+ phrase_dict[pinyin_str] += freq
+ else:
+ phrase_dict[pinyin_str] = freq
phrasefile.close()