-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrainTestScores.py
More file actions
executable file
·26 lines (24 loc) · 1.24 KB
/
trainTestScores.py
File metadata and controls
executable file
·26 lines (24 loc) · 1.24 KB
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
import os
indir = '/home/aditya/Downloads/ShortAnswerGrading_v2.0/data/scores'
for root, dirs, filenames in os.walk(indir):
for f in filenames:
if f == 'ave':
log = open(os.path.join(root, f), 'r')
root2 = "/home/aditya/PycharmProjects/short-answer-grader/Train Data/"
root3 = "/home/aditya/PycharmProjects/short-answer-grader/Test Data/"
newFile = open(root2 + root.rsplit('/', 1)[-1] + " score", "w+")
newFile2 = open(root3 + root.rsplit('/', 1)[-1] + " score", "w+")
lines = log.readlines()
newFile.writelines([item for item in lines[:-6]])
newFile2.writelines([item for item in lines[-6:]])
indir = '/home/aditya/Downloads/ShortAnswerGrading_v2.0/data/raw'
for root, dirs, filenames in os.walk(indir):
for f in filenames:
log = open(os.path.join(root, f), 'r')
root2 = "/home/aditya/PycharmProjects/short-answer-grader/Train Data/"
root3 = "/home/aditya/PycharmProjects/short-answer-grader/Test Data/"
newFile = open(root2 + f, "w+")
newFile2 = open(root3 + f, "w+")
lines = log.readlines()
newFile.writelines([item for item in lines[:-6]])
newFile2.writelines([item for item in lines[-6:]])