diff options
author | Patrick Simianer <p@simianer.de> | 2015-11-12 13:57:07 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2015-11-12 13:57:07 +0100 |
commit | 5c2833c505dda0d1646b8f8c1e62abd391f0401e (patch) | |
tree | 0259c7c2bdb531c09587a744869848d87f4bbd9e /kbest_bleu_oracles | |
parent | ef282dbe4fef1b0ae0c8544f0bb84ba674c68de7 (diff) | |
parent | 8151031373c08ccd714a99f50783eafcb54d2010 (diff) |
Merge branch 'master' of github.com:pks/scripts
Diffstat (limited to 'kbest_bleu_oracles')
-rwxr-xr-x | kbest_bleu_oracles | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/kbest_bleu_oracles b/kbest_bleu_oracles index 2b11137..a36c345 100755 --- a/kbest_bleu_oracles +++ b/kbest_bleu_oracles @@ -12,17 +12,17 @@ def get_context kbest_lists, references, n end def main - cfg = Trollop::options do + conf = Trollop::options do opt :kbest_lists, "kbest lists", :type => :string, :required => true opt :references, "reference", :type => :string, :required => true opt :n, "N for BLEU", :type => :int, :default => 4 opt :weight, "how much to weigh single translations", :type => :int, :default => 1 opt :debug, "debug mode", :type => :bool, :default => false end - debug = cfg[:debug] - n = cfg[:n] - kbest_lists = read_kbest_lists cfg[:kbest_lists] - references = ReadFile.readlines_strip cfg[:references] + debug = conf[:debug] + n = conf[:n] + kbest_lists = read_kbest_lists conf[:kbest_lists] + references = ReadFile.readlines_strip conf[:references] context = get_context kbest_lists, references, n kbest_lists.each_with_index { |kbest,j| scores = [] @@ -30,7 +30,7 @@ def main max_idx = -1 kbest.each_index { |i| context_cp = context.dup - context_cp[j] = BLEU::get_counts kbest[i].s, references[j], n, cfg[:weight] + context_cp[j] = BLEU::get_counts kbest[i].s, references[j], n, conf[:weight] score = BLEU::hbleu_(context_cp, n, debug) scores << score if score > max_score |