From 065c150956c83fccaeb98b5f7ac78675958911ca Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Tue, 10 Jan 2012 15:30:26 +0800 Subject: fixes specialtable.py --- scripts/specialtable.py | 10 ++++++++-- 1 file 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() -- cgit