-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathkx.py
68 lines (53 loc) · 1.27 KB
/
kx.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Language Version: 2.7+
# Last Modified: 2020-12-30 07:35:42
from __future__ import unicode_literals, division, absolute_import, print_function
"""
"""
__all__ = []
__author__ = "北京秘银科技 赵文平(email:[email protected] tel:13511028685)"
__version__ = "0.0.1"
import gzip
import json
with gzip.open('dict/kangxi.json.gz') as fd:
data = json.load(fd)
cipin = dict()
with open('../p0.txt') as fd:
for line in fd:
line = line.strip().split()
zi, t, cp = line
cp = int(cp)
cipin[zi] = cp
# for zi in data:
# if '國語發音' in data[zi] and zi in cipin:
# py = data[zi]['國語發音']
# pys = py.split()
# if len(pys) > 1:
# cp = cipin[zi]
# print(zi, "U+%X" % ord(zi), cp, py)
# # else:
# # print(zi)
result = set()
for zi in data:
if '國語發音' in data[zi]:
py = data[zi]['國語發音']
py = py.split()
for p in py:
result.add(p)
import pprint
#pprint.pprint(result)
a = set()
for i in result:
for j in set(i):
a.add(j)
for i in a:
print(i, i)
#print(len(result))
def main():
''''''
def test():
''''''
if __name__ == "__main__":
# main()
test()