forked from NVIDIA/waveglow
-
Notifications
You must be signed in to change notification settings - Fork 1
/
generatetrain.py
39 lines (39 loc) · 1.41 KB
/
generatetrain.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
import random
# with open("traintestset_eng/train_files_eng.txt","r") as f:
# t = f.readlines()
# result = []
# while len(result) < 13100:
# temp = random.randint(0,13099)
# if temp not in result:
# result.append(temp)
# fresult = []
# for num in range(0,45):
# tempresult = []
# for i,j in enumerate(result[num*50:(num+1)*50]):
# tempresult.append(t[j])
# with open("traintestset_eng/train_files%s_eng.txt"%(num+1),"w") as f1:
# f1.writelines(tempresult)
# tempresult = []
# for i,j in enumerate(result[-5000:]):
# tempresult.append(t[j])
# with open("traintestset_eng/test_files_eng.txt","w") as f1:
# f1.writelines(tempresult)
with open("traintestset_chn/train_files.txt","r") as f:
t = f.readlines()
result = []
while len(result) < 10000:
temp = random.randint(0,9999)
if temp not in result:
result.append(temp)
fresult = []
for num in range(0,45):
tempresult = []
for i,j in enumerate(result[num*90:(num+1)*90]):
tempresult.append(t[j])
with open("traintestset_chn/train_files%s.txt"%(num+1),"w") as f1:
f1.writelines(tempresult)
tempresult = []
for i,j in enumerate(result[-5000:]):
tempresult.append(t[j])
with open("traintestset_chn/test_files.txt","w") as f1:
f1.writelines(tempresult)