summaryrefslogtreecommitdiff
path: root/lampion.rb
diff options
context:
space:
mode:
authorPatrick Simianer <simianer@cl.uni-heidelberg.de>2014-04-01 13:45:23 +0200
committerPatrick Simianer <simianer@cl.uni-heidelberg.de>2014-04-01 13:45:23 +0200
commitbe45f7b253c23757449103ffe3005107ce9169fa (patch)
treecd9bf6d12193bb8ffc1e8d4a610b5e0679703495 /lampion.rb
parent00e2f9f227c28242ce97cfc7f86a953b84062d3f (diff)
cv version
Diffstat (limited to 'lampion.rb')
-rwxr-xr-xlampion.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lampion.rb b/lampion.rb
index 00b5508..ab8861f 100755
--- a/lampion.rb
+++ b/lampion.rb
@@ -68,7 +68,7 @@ def adjust_model_scores kbest, factor
min = kbest.map{ |k| k.scores[:decoder] }.min
max = kbest.map{ |k| k.scores[:decoder] }.max
return if min==0&&max==0
- kbest.each { |k| k.scores[:decoder] = factor*((k.scores[:decoder]-min)/(max-min)) }
+ kbest.each { |k| k.scores[:decoder_orig] = k.scores[:decoder]; k.scores[:decoder] = factor*((k.scores[:decoder]-min)/(max-min)) }
end
def main
@@ -187,15 +187,15 @@ def main
# get per-sentence BLEU scores
kbest.each { |k| k.scores[:psb] = BLEU::per_sentence_bleu k.s, references[j] }
+ # map decoder scores to [0,1]
+ adjust_model_scores kbest, cfg[:scale_model]
+
if cfg[:print_kbest]
STDERR.write "\n<<< KBEST\n"
kbest.each_with_index { |k,l| STDERR.write k.to_s2+"\n" }
STDERR.write ">>>\n"
end
- # map decoder scores to [0,1]
- adjust_model_scores kbest, cfg[:scale_model]
-
# informative output
STDERR.write "\n [TOP1]\n"
# print 1best on last iteration