PageRenderTime 11ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/python/engine/PinYin/tools/filter_duoyin.py

http://scim-python.googlecode.com/
Python | 23 lines | 19 code | 4 blank | 0 comment | 12 complexity | 591d41675a244a76ae6b74346237407e MD5 | raw file
 1import sets as Set
 2i=0
 3count = 0
 4
 5dic = {}
 6dic_m = {}
 7
 8for l in file ("pinyin_table.txt"):
 9	ll = unicode(l,"utf8")[:-1]
10	p = (ll).split(u"\t")
11	if p[0] not in dic:
12		dic[p[0]] = [(p[1],p[2])]
13	else:
14		if p[0] not in dic_m:
15			dic_m[p[0]] = dic[p[0]]
16		dic_m[p[0]].append((p[1],p[2]))
17
18for k, v in dic_m.items ():
19	print k.encode ("utf-8"),
20	for l in v:
21		print l[0],l[1],
22	print
23