-
Notifications
You must be signed in to change notification settings - Fork 0
/
extract_number_of_food_keywords.py
58 lines (53 loc) · 1.22 KB
/
extract_number_of_food_keywords.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
import os
import datetime
import csv
import statistics
times_and_files = []
not_two = []
not_found = []
solution_file_name_endings = """admmt1.cha
aimmt1.cha
allmt1.cha
anamt1.cha
annmt1.cha
aprmt1.cha
bramt1.cha
brimt1.cha
brnmt1.cha
brtmt1.cha
casmt1.cha
conmt1.cha
davmt1.cha
diamt1.cha
emimt1.cha
ethmt1.cha
geomt1.cha
gilmt1.cha
gremt1.cha
guymt1.cha
jacmt1.cha""".split()
file_paths = []
# -- ALL FILES --
# for corp in corpus:
# dir_path = "/".join([path_base, corp, ending])
# for file_name in os.listdir(dir_path):
# file_path = dir_path + '/' + file_name
# file_paths.append(file_path)
# -- JUST SOLUTIONS --
for ending in solution_file_name_endings:
file_path = "HSLLD/HV1/MT/" + ending
file_paths.append(file_path)
num_lines = []
for file_path in file_paths:
with open(file_path) as f:
lines = f.readlines()
just_text = 0
for line in lines:
if line[0] == "*":
just_text += 1
num_lines.append(just_text)
print(num_lines)
print("max lines: {}".format(max(num_lines)))
print("mean lines: {}".format(sum(num_lines) / len(num_lines)))
print("min lines: {}".format(min(num_lines)))
print("std.dev: {}".format(statistics.stdev(num_lines)))