diff options
author | Patrick Simianer <p@simianer.de> | 2016-07-05 11:01:46 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2016-07-05 11:01:46 +0200 |
commit | 2b1d7f881c19c4d4b5afae194e02d3300c7675d0 (patch) | |
tree | 5a06ee7de98640a39244b57bb369697176b44ebf /per-sentence-bleu-kbest | |
parent | 69949dda35c3ea21d8e926e5f0a596a0a0f61c6a (diff) |
mv
Diffstat (limited to 'per-sentence-bleu-kbest')
-rwxr-xr-x | per-sentence-bleu-kbest | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/per-sentence-bleu-kbest b/per-sentence-bleu-kbest new file mode 100755 index 0000000..f8bd860 --- /dev/null +++ b/per-sentence-bleu-kbest @@ -0,0 +1,32 @@ +#!/usr/bin/env ruby + +require 'zipf' +require 'trollop' + +def main + conf = Trollop::options do + opt :kbests, "kbests", :type => :string, :default => '-' + opt :references, "references", :type => :string, :required => true + end + refs = ReadFile.new conf[:references] + kbest_lists = read_kbest_lists conf[:kbests] + i = 0 + kbest_lists.each { |list| + scores = [] + o = false + list.each { |e| scores << per_sentence_bleu(e, refs[i]) } + max = scores.max + scores.each_with_index { |x,j| + puts "#{j+1} ||| #{scores[j]} ||| #{list[j]}" + if scores[j]==max && !o + puts "^^^ #{j+1} #{max}" + o = true + end + } + puts + i += 1 + } +end + +main + |