-
Notifications
You must be signed in to change notification settings - Fork 135
/
Copy pathkeys.py
24 lines (23 loc) · 807 Bytes
/
keys.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
import pickle as pkl
# gen alphabet via label
# alphabet_set = set()
# infofiles = ['infofiles/infofile_selfcollect.txt','infofiles/infofile_train_public.txt']
# for infofile in infofiles:
# f = open(infofile)
# content = f.readlines()
# f.close()
# for line in content:
# if len(line.strip())>0:
# if len(line.strip().split('\t'))!=2:
# print(line)
# else:
# fname,label = line.strip().split('\t')
# for ch in label:
# alphabet_set.add(ch)
#
# alphabet_list = sorted(list(alphabet_set))
# pkl.dump(alphabet_list,open('alphabet.pkl','wb'))
alphabet_list = pkl.load(open('recognize/alphabet.pkl','rb'))
alphabet = [ord(ch) for ch in alphabet_list]
alphabet_v2 = alphabet
# print(alphabet_v2)