-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintention_relations_count.py
More file actions
46 lines (29 loc) · 1.17 KB
/
intention_relations_count.py
File metadata and controls
46 lines (29 loc) · 1.17 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import os
from tqdm import tqdm
from collections import Counter
def file_len_with_relation(filename):
sync_count = 0
async_count = 0
contingency_count = 0
with open(filename) as f:
for i, line in enumerate(f):
if "and simultaneously," in line:
sync_count += 1
if "mainly because" in line:
contingency_count += 1
if "usually after" in line:
async_count += 1
return sync_count, async_count, contingency_count
total_sync = 0
total_async = 0
total_contingency = 0
for file in tqdm(os.listdir("/data/jbai/session_data/vera_relations_finetuned")):
if file.endswith(".csv"):
sync, async_, contingency = file_len_with_relation(f"/data/jbai/session_data/vera_relations_finetuned/{file}")
total_sync += sync
total_async += async_
total_contingency += contingency
print("Total sync: ", total_sync)
print("Total async: ", total_async)
print("Total contingency: ", total_contingency)
print("Total relations: ", total_sync + total_async + total_contingency)