-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstart.py
66 lines (51 loc) · 2.44 KB
/
start.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
59
60
61
62
63
64
65
66
from fusion import start_fusion as fusion
from extractFragments import extractFromFile as extract
import sys, subprocess
argument1 = str(1)
argument2 = str(1)
#0 uses exact match
#1 uses Levenshtein
if __name__ == "__main__":
if len(sys.argv) <4:
print "python start.py input_BU input_TD groundtruth"
exit(1)
else:
input_BU = sys.argv[1]
input_TD = sys.argv[2]
groundtruth = sys.argv[3]
# input_BU can stay as it is
# Patterns from input_TD have to be extracted and mapped according to the groundtruth
extract(input_TD,"extracted",groundtruth)
print "Extraction and mapping done"
# create fusion
# fusion(input_BU,"extracted","fusion_result")
fusion(input_BU,"extracted","fusion_result")
print "Fusion of "+str(input_BU)+" and "+str(input_TD)+" is done"
print
# evaluation perl .pl ground input_BU 1 1
cmd = ["perl", "eval_metrics_v3.pl", groundtruth, input_BU,argument1,argument2]
pipe = subprocess.Popen(cmd,stdout=subprocess.PIPE)
pipe.wait()
cmd = ["perl", "results2texV2.pl", "evaluation_results/"+input_BU+".L1_"+argument1+"L2_"+argument2+".results.csv"]
pipe = subprocess.Popen(cmd,stdout=subprocess.PIPE)
pipe.wait()
print "Evaluation of "+str(input_BU)+ " done"
print
# evaluation perl .pl ground extracted 1 1
# cmd = ["perl", "eval_metrics.pl", groundtruth, "extracted","1","1"]
cmd = ["perl", "eval_metrics_v3.pl", groundtruth, "extracted",argument1,argument2]
pipe = subprocess.Popen(cmd,stdout=subprocess.PIPE)
pipe.wait()
cmd = ["perl", "results2texV2.pl", "evaluation_results/extracted.L1_"+argument1+"L2_"+argument2+".results.csv"]
pipe = subprocess.Popen(cmd,stdout=subprocess.PIPE)
pipe.wait()
print "Evaluation of the extracted fragments is done"
print
# evaluation perl .pl ground fusion 1 1
cmd = ["perl", "eval_metrics_v3.pl", groundtruth, "fusion_result",argument1,argument2]
pipe = subprocess.Popen(cmd,stdout=subprocess.PIPE)
pipe.wait()
cmd = ["perl", "results2texV2.pl", "evaluation_results/fusion_result.L1_"+argument1+"L2_"+argument2+".results.csv"]
pipe = subprocess.Popen(cmd,stdout=subprocess.PIPE)
pipe.wait()
print "Evaluation of the fused fragments is done"