summaryrefslogtreecommitdiff
path: root/bleu-cmp
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2018-10-19 08:36:03 +0200
committerPatrick Simianer <p@simianer.de>2018-10-19 08:36:03 +0200
commit7d3fb5215496dc4e2bbc93234492ce3e00596036 (patch)
tree459bca05a3dc4002aa1fadfbfc65be91d1759307 /bleu-cmp
parentaefe594fa5c594719db4e3a050d983577127c1ad (diff)
mv
Diffstat (limited to 'bleu-cmp')
-rwxr-xr-xbleu-cmp23
1 files changed, 23 insertions, 0 deletions
diff --git a/bleu-cmp b/bleu-cmp
new file mode 100755
index 0000000..ed8460c
--- /dev/null
+++ b/bleu-cmp
@@ -0,0 +1,23 @@
+#!/usr/bin/env ruby
+
+require 'zipf'
+
+f = ReadFile.new ARGV[0]
+g = ReadFile.new ARGV[1]
+h = ReadFile.new ARGV[2]
+
+i = 0
+while line = f.gets
+ line1 = g.gets
+ line2 = h.gets
+ b1 = (BLEU::per_sentence_bleu(line1.strip, line.split, 4)*100).round 1
+ b2 = (BLEU::per_sentence_bleu(line2.strip, line.split, 4)*100).round 1
+ puts i
+ puts "ref) " + line
+ puts "org #{b1}) " + line1
+ puts "ada #{b2}) " + line2
+ puts " >>> #{(b2-b1).round 1} <<<"
+ puts
+ i += 1
+end
+