7 stats['imprecise'] = []
8 stats['false-positives'] = []
9 stats['undetected'] = []
11 for line in open(sys.argv[1]):
15 cols = line.split('|')
18 print "Warning: outcome of %s is %s, skipping it" % (name, cols[1])
20 expected_error = cols[2]
21 real_errors = cols[3].split(',')
22 spurious_errors = cols[4].split(',')
24 stats['total'].append((name,real_errors))
25 if set([expected_error]) == set(real_errors):
26 if expected_error in spurious_errors:
27 stats['false-positives'].append((name,real_errors))
29 stats['precise'].append((name,real_errors))
30 elif expected_error in real_errors:
31 if expected_error in spurious_errors:
32 stats['false-positives'].append((name,real_errors))
34 stats['imprecise'].append((name,real_errors))
36 if expected_error in spurious_errors:
37 stats['false-positives'].append((name,real_errors))
39 stats['undetected'].append((name,real_errors))
41 for field in ['undetected', 'imprecise', 'false-positives']:
42 print "===================="
44 for name,_ in stats[field]:
51 return "%6.1f" % (reduce(lambda acc,x: acc+x,l,0)/float(len(l)))
59 def format_stat(field):
62 errors = map(lambda x: len(x[1]),lista)
63 locations = map(lambda x: len(set(x[1])),lista)
64 return r'%-15s & %6d & %6s & %6d & %6s & %6d & %6.1f\%% \\' % \
65 (field, len(lista), average(locations),mymax(locations),
66 average(errors),mymax(errors),float(len(lista)) /
67 len(stats['total']) * 100)
70 print format_stat('precise')
71 print format_stat('imprecise')
72 print format_stat('false-positives')
73 print format_stat('undetected')
75 print format_stat('total')