summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2017-08-04 12:48:43 +0200
committerPatrick Simianer <p@simianer.de>2017-08-04 12:48:43 +0200
commit1073fe2be724dd0ae67bd843349c4896efabbe9f (patch)
treefa87b1ce6d2478945aee8f141e23e05b4f263fc0
parent9f1d31143bb695ed87e773a60224a2ae84b8fd8c (diff)
cumul
-rwxr-xr-xcumul32
1 files changed, 32 insertions, 0 deletions
diff --git a/cumul b/cumul
new file mode 100755
index 0000000..93a7e90
--- /dev/null
+++ b/cumul
@@ -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
+