diff options
author | Patrick Simianer <simianer@cl.uni-heidelberg.de> | 2014-04-01 13:45:23 +0200 |
---|---|---|
committer | Patrick Simianer <simianer@cl.uni-heidelberg.de> | 2014-04-01 13:45:23 +0200 |
commit | be45f7b253c23757449103ffe3005107ce9169fa (patch) | |
tree | cd9bf6d12193bb8ffc1e8d4a610b5e0679703495 | |
parent | 00e2f9f227c28242ce97cfc7f86a953b84062d3f (diff) |
cv version
-rwxr-xr-x | lampion.rb | 8 | ||||
-rwxr-xr-x | scripts/geoquery/query.rb | 4 | ||||
-rwxr-xr-x | scripts/geoquery/semparse.rb | 4 | ||||
-rwxr-xr-x | scripts/geoquery/test-nof-old.sh | 5 | ||||
-rwxr-xr-x | scripts/geoquery/test-nof.sh | 5 | ||||
-rwxr-xr-x | scripts/geoquery/test.sh | 5 | ||||
-rwxr-xr-x | scripts/geoquery/translate.sh | 4 |
7 files changed, 29 insertions, 6 deletions
@@ -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 diff --git a/scripts/geoquery/query.rb b/scripts/geoquery/query.rb index 25cded5..3b4b681 100755 --- a/scripts/geoquery/query.rb +++ b/scripts/geoquery/query.rb @@ -1,9 +1,11 @@ #!/usr/bin/env ruby require 'nlp_ruby' -require_relative '../../cfg.rb' +require 'memcached' +require_relative ARGV[0] + while line = STDIN.gets puts `echo "execute_funql_query(#{line}, X)." | swipl -s #{EVAL_PL} 2>&1 | grep "X ="`.gsub('X = ','').strip end diff --git a/scripts/geoquery/semparse.rb b/scripts/geoquery/semparse.rb index 9858ade..45fe98c 100755 --- a/scripts/geoquery/semparse.rb +++ b/scripts/geoquery/semparse.rb @@ -1,9 +1,11 @@ #!/usr/bin/env ruby require 'nlp_ruby' -require_relative '../../cfg.rb' +require 'memcached' +require_relative ARGV[0] + while line = STDIN.gets puts `#{SMT_SEMPARSE} "#{line}"` end diff --git a/scripts/geoquery/test-nof-old.sh b/scripts/geoquery/test-nof-old.sh new file mode 100755 index 0000000..99a8241 --- /dev/null +++ b/scripts/geoquery/test-nof-old.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +/workspace/grounded/lampion/scripts/geoquery/translate.sh $1 $2 < /workspace/grounded/lampion/proper/d/split880.test-nof-old.in | tee $2.transl | /workspace/grounded/lampion/scripts/geoquery/semparse.rb $3 | tee $2.parsed | /workspace/grounded/lampion/scripts/geoquery/query.rb $3 > $2.output +/workspace/grounded/lampion/scripts/geoquery/eval.rb /workspace/grounded/lampion/proper/d/split880.test-nof.gold < $2.output > $2.result + diff --git a/scripts/geoquery/test-nof.sh b/scripts/geoquery/test-nof.sh new file mode 100755 index 0000000..786afc2 --- /dev/null +++ b/scripts/geoquery/test-nof.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +/workspace/grounded/lampion/scripts/geoquery/translate.sh $1 $2 < /workspace/grounded/lampion/proper/d/split880.test-nof.in | tee $2.transl | /workspace/grounded/lampion/scripts/geoquery/semparse.rb $3 | tee $2.parsed | /workspace/grounded/lampion/scripts/geoquery/query.rb $3 > $2.output +/workspace/grounded/lampion/scripts/geoquery/eval.rb /workspace/grounded/lampion/proper/d/split880.test-nof.gold < $2.output > $2.result + diff --git a/scripts/geoquery/test.sh b/scripts/geoquery/test.sh new file mode 100755 index 0000000..3ac8b2d --- /dev/null +++ b/scripts/geoquery/test.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +/workspace/grounded/lampion/scripts/geoquery/translate.sh $1 $2 < /workspace/grounded/lampion/proper/d/split880.test.in | tee $2.transl | /workspace/grounded/lampion/scripts/geoquery/semparse.rb $3 | tee $2.parsed | /workspace/grounded/lampion/scripts/geoquery/query.rb $3 > $2.output +/workspace/grounded/lampion/scripts/geoquery/eval.rb /workspace/grounded/lampion/proper/d/split880.test.gold < $2.output > $2.result + diff --git a/scripts/geoquery/translate.sh b/scripts/geoquery/translate.sh new file mode 100755 index 0000000..af15aa1 --- /dev/null +++ b/scripts/geoquery/translate.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +/toolbox/cdec-dtrain/decoder/cdec -c $1 -w $2 2>/dev/null + |