Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pinyin.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ def hanzi2pinyin(self, string=""):
if not isinstance(string, unicode):
string = string.decode("utf-8")

print res.status,res.reason
for char in string:
key = '%X' % ord(char)
result.append(self.word_dict.get(key, char).split()[0][:-1].lower())
if self.word_dict.get(key)!=None :
result.append(self.word_dict.get(key).split()[0][:-1].lower())

return result

Expand Down
2 changes: 1 addition & 1 deletion word.data
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
3438 QIAN4
3439 YI4
343A ZHONG4
343B N3 NEI4 NG3
343B NEI4 NG3
343C CHENG4 ZHENG3
3441 ZHUO1
3442 FANG3 PANG2
Expand Down