summaryrefslogtreecommitdiff
path: root/kbest_bleu_oracles
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2015-06-10 14:48:34 +0200
committerPatrick Simianer <p@simianer.de>2015-06-10 14:48:34 +0200
commit8151031373c08ccd714a99f50783eafcb54d2010 (patch)
tree1bcf6e78392978f4ae972a5dcc936a4c266f3d78 /kbest_bleu_oracles
parente137509a77e3a8c12af32852ebba893dacb53f85 (diff)
undo unfortunate variable naming: cfg -> conf!
Diffstat (limited to 'kbest_bleu_oracles')
-rwxr-xr-xkbest_bleu_oracles12
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