diff options
author | Patrick Simianer <simianer@cl.uni-heidelberg.de> | 2014-03-03 19:10:50 +0100 |
---|---|---|
committer | Patrick Simianer <simianer@cl.uni-heidelberg.de> | 2014-03-03 19:10:50 +0100 |
commit | d6a28bc7ad3339ea1cf352ec62e331e45a4aeba3 (patch) | |
tree | 19e291689a9d6a91d483c2180f81cddb54cfe98a /scripts/geoquery | |
parent | b41cafa4772a0a1e6028c5671c0d352c20b491bb (diff) |
geoquery scripts + example
Diffstat (limited to 'scripts/geoquery')
-rwxr-xr-x | scripts/geoquery/eval.rb | 17 | ||||
-rwxr-xr-x | scripts/geoquery/query.rb | 11 | ||||
-rwxr-xr-x | scripts/geoquery/semparse.rb | 11 |
3 files changed, 39 insertions, 0 deletions
diff --git a/scripts/geoquery/eval.rb b/scripts/geoquery/eval.rb new file mode 100755 index 0000000..e605fa5 --- /dev/null +++ b/scripts/geoquery/eval.rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby + +require 'nlp_ruby' + + +gold = ReadFile.readlines_strip ARGV[0] +i = j = correct = 0 +while line = STDIN.gets + line.strip! + correct += 1 if line==gold[i] + i += 1 + j += 1 if line=='' # no parse +end +acc = correct.to_f/i +prec = correct.to_f/(i-j) +puts "acc=#{(100*acc).round 2} prec=#{(100*prec).round 2} (#{i}/#{j}) abs=#{correct} f1=#{(100*(2*acc*prec)/(acc+prec)).round 2}" + diff --git a/scripts/geoquery/query.rb b/scripts/geoquery/query.rb new file mode 100755 index 0000000..9cec355 --- /dev/null +++ b/scripts/geoquery/query.rb @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby + +require 'nlp_ruby' + + +EVAL_PL='/workspace/grounded/wasp-1.0/data/geo-funql/eval/eval.pl' + +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 new file mode 100755 index 0000000..ebcbfbe --- /dev/null +++ b/scripts/geoquery/semparse.rb @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby + +require 'nlp_ruby' + + +SMT_SEMPARSE = 'python /workspace/grounded/smt-semparse-cp/decode_sentence.py /workspace/grounded/smt-semparse-cp/working/full_dataset' + +while line = STDIN.gets + puts `#{SMT_SEMPARSE} "#{line}"` +end + |