-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMT_analysis.py
53 lines (51 loc) · 2.07 KB
/
MT_analysis.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
import csv
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser(
prog='MT Analysis')
parser.add_argument('-f', '--filename', required=True)
args = parser.parse_args()
data = []
with open(args.filename, 'r')as csvfile:
reader = csv.reader(csvfile, delimiter=',')
for row in reader:
data.append(row)
print(f'DRAWN DATA FROM {args.filename} counting transformation')
data = [x[2] for x in data]
transformer_count = {'addcomment': 0,
'addneutral': 0,
'addvar': 0,
'forone': 0,
'iffalseelse': 0,
'iftrue': 0,
'lambdaidentity': 0,
'renameparam': 0,
'renamevar': 0,
'whiletrue': 0,
}
data = [s.split(',') for s in data]
for s in data:
for t in s:
match t:
case 'AddVariableTransformer':
transformer_count['addvar']+=1
case 'AddCommentTransformer':
transformer_count['addcomment']+=1
case 'RenameVariableTransformer':
transformer_count['renamevar']+=1
case 'RenameParameterTransformer':
transformer_count['renameparam']+=1
case 'LambdaIdentityTransformer':
transformer_count['lambdaidentity']+=1
case 'AddNeutralElementTransformer':
transformer_count['addneutral']+=1
case 'IfTrueTransformer':
transformer_count['iftrue']+=1
case 'IfFalseElseTransformer':
transformer_count['iffalseelse']+=1
case 'ForOneTransformer':
transformer_count['forone']+=1
case 'WhileTrueTransformer':
transformer_count['whiletrue']+=1
for k in transformer_count.keys():
print(f'{k} : {transformer_count[k]}')