From f343459d6198352964dbb6779f15c352fe2d5794 Mon Sep 17 00:00:00 2001 From: Jacob Date: Sun, 28 Jul 2013 09:54:54 +0100 Subject: init --- src/eval_bevan/format_prolog.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 src/eval_bevan/format_prolog.py (limited to 'src/eval_bevan/format_prolog.py') diff --git a/src/eval_bevan/format_prolog.py b/src/eval_bevan/format_prolog.py new file mode 100755 index 0000000..aa60fd7 --- /dev/null +++ b/src/eval_bevan/format_prolog.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python2 + +import sys + +def main(): + HYP_PATH = sys.argv[1] + REF_PATH = sys.argv[2] + + hyp_file = open(HYP_PATH) + ref_file = open(REF_PATH) + + hyps = [] + for hyp_line in hyp_file.readlines(): + hyp = hyp_line.strip() + hyps.append(hyp) + + refs = [] + for r_line in ref_file.readlines(): + ref = r_line.strip() + refs.append(ref) + + i = 0 + for ref, hyp in zip(refs, hyps): + print \ + 'catch(call_with_time_limit(1,eval([%d,%f,%s,%s])),E,writeln(\'error\')).\n' \ + % (i, 0, ref, hyp) + i += 1 + +if __name__ == '__main__': + main() -- cgit v1.2.3