summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/geoquery/eval.rb17
-rwxr-xr-xscripts/geoquery/query.rb11
-rwxr-xr-xscripts/geoquery/semparse.rb11
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
+