diff options
author | Patrick Simianer <p@simianer.de> | 2017-08-04 12:48:43 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2017-08-04 12:48:43 +0200 |
commit | 1073fe2be724dd0ae67bd843349c4896efabbe9f (patch) | |
tree | fa87b1ce6d2478945aee8f141e23e05b4f263fc0 | |
parent | 9f1d31143bb695ed87e773a60224a2ae84b8fd8c (diff) |
cumul
-rwxr-xr-x | cumul | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -0,0 +1,32 @@ +#!/usr/bin/env ruby + +require 'zipf' + +f = ReadFile.new ARGV[0] +g = ReadFile.new ARGV[1] +h = ReadFile.new ARGV[2] + +refs = [] +sys1 = [] +sys2 = [] +diffs = [] +while line = f.gets + line1 = g.gets + line2 = h.gets + refs << line + sys1 << line1 + sys2 << line2 + + ff=File.new("/tmp/refs",'w+');ff.write(refs.join(""));ff.close + ff=File.new("/tmp/sys1",'w+');ff.write(sys1.join(""));ff.close + ff=File.new("/tmp/sys2",'w+');ff.write(sys2.join(""));ff.close + + #a = `~/multi-bleu.perl /tmp/refs < /tmp/sys1`.split[2].gsub(',','').to_f + a = BLEU::bleu("/tmp/sys1", "/tmp/refs", 4) + b = BLEU::bleu("/tmp/sys2", "/tmp/refs", 4) + diffs << b-a + + #puts ((diffs.inject(:+)/diffs.size)*100).round 2 + puts (diffs[-1]*100).round 2 +end + |