-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrash.py
More file actions
27 lines (22 loc) · 686 Bytes
/
trash.py
File metadata and controls
27 lines (22 loc) · 686 Bytes
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
import glob
import numpy as np
import pickle, os
def loadDataset(pklPath):
with open(pklPath, "rb") as pklFile:
return np.array(pickle.load(pklFile, encoding="utf-8"))
def extractor(n=5):
#n is number of opinions from each year"
filename = "paragraphs/"
datafiles = sorted(glob.glob(filename + "para_????"))
test_files = []
for d in datafiles:
paragraphs = sorted(glob.glob(d + "/*.pkl"))
for i, para in enumerate(paragraphs):
if i > n:
break
myfile = loadDataset(para)
for j in myfile:
test_files.append(j)
return test_files
a = extractor()
print(len(a))