in tseval/evaluation/terp.py [0:0]
def parse_terp_file(filepath):
'''Parse the output terp.sum file.
Format:
ID | Ins | Del | Sub | Stem | Syn | Phrase | Shft | WdSh | NumEr | NumWd | TERp
-------------------------------------------------------------------------------------------------------------------------------------------------
[sys][doc][0] | 0 | 11 | 4 | 0 | 0 | 0 | 2 | 3 | 17.000 | 19.000 | 89
[sys][doc][1] | 0 | 15 | 1 | 0 | 0 | 0 | 0 | 0 | 16.000 | 23.000 | 69
'''
with open(filepath, 'r') as f:
line_id = 0
features = []
for line in f:
m = re.match(r'\[sys\]\[doc\]\[(\d+)\] +\|(.*)', line)
if m is None:
continue
assert line_id == int(m.groups()[0])
line_id += 1
features.append([float(val) for val in m.groups()[1].split('|')])
return np.array(features)