diff options
author | Peng Wu <alexepico@gmail.com> | 2012-01-10 15:30:26 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2012-01-10 17:50:30 +0800 |
commit | 065c150956c83fccaeb98b5f7ac78675958911ca (patch) | |
tree | fb18bebc6f290309199c9f486ed0a693ea400670 | |
parent | 18e2714d4c67d55d9c054f8087b297e7862b433f (diff) | |
download | libpinyin-065c150956c83fccaeb98b5f7ac78675958911ca.tar.gz |
fixes specialtable.py
-rw-r--r-- | scripts/specialtable.py | 10 |
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() |