diff options
Diffstat (limited to 'example_geoquery')
-rw-r--r-- | example_geoquery/cdec.ini | 9 | ||||
-rw-r--r-- | example_geoquery/cfg.rb | 8 | ||||
-rw-r--r-- | example_geoquery/data.en | 10 | ||||
-rw-r--r-- | example_geoquery/data.funql | 10 | ||||
-rw-r--r-- | example_geoquery/data.gold | 10 | ||||
-rw-r--r-- | example_geoquery/data.in | 10 | ||||
-rw-r--r-- | example_geoquery/data.prolog | 10 | ||||
-rw-r--r-- | example_geoquery/grammar/grammar.15.gz | bin | 0 -> 17487 bytes | |||
-rw-r--r-- | example_geoquery/grammar/grammar.16.gz | bin | 0 -> 17489 bytes | |||
-rw-r--r-- | example_geoquery/grammar/grammar.25.gz | bin | 0 -> 7307 bytes | |||
-rw-r--r-- | example_geoquery/grammar/grammar.26.gz | bin | 0 -> 25672 bytes | |||
-rw-r--r-- | example_geoquery/grammar/grammar.29.gz | bin | 0 -> 22610 bytes | |||
-rw-r--r-- | example_geoquery/grammar/grammar.3.gz | bin | 0 -> 4659 bytes | |||
-rw-r--r-- | example_geoquery/grammar/grammar.33.gz | bin | 0 -> 7612 bytes | |||
-rw-r--r-- | example_geoquery/grammar/grammar.34.gz | bin | 0 -> 7601 bytes | |||
-rw-r--r-- | example_geoquery/grammar/grammar.37.gz | bin | 0 -> 11126 bytes | |||
-rw-r--r-- | example_geoquery/grammar/grammar.6.gz | bin | 0 -> 43680 bytes | |||
-rw-r--r-- | example_geoquery/run.sh | 36 |
18 files changed, 103 insertions, 0 deletions
diff --git a/example_geoquery/cdec.ini b/example_geoquery/cdec.ini new file mode 100644 index 0000000..b9b564d --- /dev/null +++ b/example_geoquery/cdec.ini @@ -0,0 +1,9 @@ +formalism=scfg +intersection_strategy=cube_pruning +cubepruning_pop_limit=30 +scfg_max_span_limit=15 +feature_function=WordPenalty +feature_function=RuleIdentityFeatures +feature_function=RuleSourceBigramFeatures +feature_function=RuleTargetBigramFeatures +feature_function=RuleShape diff --git a/example_geoquery/cfg.rb b/example_geoquery/cfg.rb new file mode 100644 index 0000000..94fef2e --- /dev/null +++ b/example_geoquery/cfg.rb @@ -0,0 +1,8 @@ +_PATH = '/workspace/grounded/test' +SMT_SEMPARSE = "python #{_PATH}/smt-semparse/decode_sentence.py /workspace/grounded/test/smt-semparse/work/full_dataset" +EVAL_PL = "#{_PATH}/wasp-1.0/data/geo-funql/eval/eval.pl" +ACCEPT_ZOMBIES = true +TIMEOUT = 60 +CDEC_BIN = '/toolbox/cdec/decoder/cdec' +$cache = Memcached.new('localhost:31337') + diff --git a/example_geoquery/data.en b/example_geoquery/data.en new file mode 100644 index 0000000..7d7740e --- /dev/null +++ b/example_geoquery/data.en @@ -0,0 +1,10 @@ +name all the rivers in colorado +count the states which have elevations lower than what alabama has +give me the number of rivers in california +give me the states that border utah +how high is mount mckinley +how high is the highest point in america +how high is the highest point of alabama +how large is alaska +how large is texas +how long is the colorado river diff --git a/example_geoquery/data.funql b/example_geoquery/data.funql new file mode 100644 index 0000000..6843394 --- /dev/null +++ b/example_geoquery/data.funql @@ -0,0 +1,10 @@ +answer(river(loc_2(stateid('colorado')))) +answer(count(state(low_point_2(lower_2(low_point_1(stateid('alabama'))))))) +answer(count(river(loc_2(stateid('california'))))) +answer(state(next_to_2(stateid('utah')))) +answer(elevation_1(placeid('mount mckinley'))) +answer(elevation_1(highest(place(loc_2(countryid('usa')))))) +answer(elevation_1(highest(place(loc_2(stateid('alabama')))))) +answer(size(stateid('alaska'))) +answer(size(stateid('texas'))) +answer(len(river(riverid('colorado')))) diff --git a/example_geoquery/data.gold b/example_geoquery/data.gold new file mode 100644 index 0000000..aed50af --- /dev/null +++ b/example_geoquery/data.gold @@ -0,0 +1,10 @@ +[riverid(arkansas),riverid(canadian),riverid(colorado),riverid(green),riverid('north platte'),riverid(republican),riverid('rio grande'),riverid('san juan'),riverid('smoky hill'),riverid('south platte')] +[2] +[1] +[stateid(arizona),stateid(colorado),stateid(idaho),stateid(nevada),stateid('new mexico'),stateid(wyoming)] +[6194] +[6194] +[734] +[591000.0] +[266807.0] +[2333] diff --git a/example_geoquery/data.in b/example_geoquery/data.in new file mode 100644 index 0000000..e678525 --- /dev/null +++ b/example_geoquery/data.in @@ -0,0 +1,10 @@ +<seg grammar="grammar/grammar.3.gz" id="3"> nenne alle flüsse in colorado </seg> +<seg grammar="grammar/grammar.6.gz" id="6"> zähle die staaten , welche erhebungen haben , die niedriger liegen als jene in alabama </seg> +<seg grammar="grammar/grammar.15.gz" id="15"> nenne mir die anzahl der flüsse in california </seg> +<seg grammar="grammar/grammar.16.gz" id="16"> nenne mir die staaten , welche an utah grenzen </seg> +<seg grammar="grammar/grammar.25.gz" id="25"> wie hoch ist mount mckinley </seg> +<seg grammar="grammar/grammar.26.gz" id="26"> wie hoch liegt der höchste punkt in amerika </seg> +<seg grammar="grammar/grammar.29.gz" id="29"> wie hoch liegt der höchste punkt in alabama </seg> +<seg grammar="grammar/grammar.33.gz" id="33"> wie groß ist alaska </seg> +<seg grammar="grammar/grammar.34.gz" id="34"> wie groß ist texas </seg> +<seg grammar="grammar/grammar.37.gz" id="37"> wie lang ist der colorado fluss </seg> diff --git a/example_geoquery/data.prolog b/example_geoquery/data.prolog new file mode 100644 index 0000000..6843394 --- /dev/null +++ b/example_geoquery/data.prolog @@ -0,0 +1,10 @@ +answer(river(loc_2(stateid('colorado')))) +answer(count(state(low_point_2(lower_2(low_point_1(stateid('alabama'))))))) +answer(count(river(loc_2(stateid('california'))))) +answer(state(next_to_2(stateid('utah')))) +answer(elevation_1(placeid('mount mckinley'))) +answer(elevation_1(highest(place(loc_2(countryid('usa')))))) +answer(elevation_1(highest(place(loc_2(stateid('alabama')))))) +answer(size(stateid('alaska'))) +answer(size(stateid('texas'))) +answer(len(river(riverid('colorado')))) diff --git a/example_geoquery/grammar/grammar.15.gz b/example_geoquery/grammar/grammar.15.gz Binary files differnew file mode 100644 index 0000000..416152f --- /dev/null +++ b/example_geoquery/grammar/grammar.15.gz diff --git a/example_geoquery/grammar/grammar.16.gz b/example_geoquery/grammar/grammar.16.gz Binary files differnew file mode 100644 index 0000000..19189e6 --- /dev/null +++ b/example_geoquery/grammar/grammar.16.gz diff --git a/example_geoquery/grammar/grammar.25.gz b/example_geoquery/grammar/grammar.25.gz Binary files differnew file mode 100644 index 0000000..a441190 --- /dev/null +++ b/example_geoquery/grammar/grammar.25.gz diff --git a/example_geoquery/grammar/grammar.26.gz b/example_geoquery/grammar/grammar.26.gz Binary files differnew file mode 100644 index 0000000..753e491 --- /dev/null +++ b/example_geoquery/grammar/grammar.26.gz diff --git a/example_geoquery/grammar/grammar.29.gz b/example_geoquery/grammar/grammar.29.gz Binary files differnew file mode 100644 index 0000000..56c91cd --- /dev/null +++ b/example_geoquery/grammar/grammar.29.gz diff --git a/example_geoquery/grammar/grammar.3.gz b/example_geoquery/grammar/grammar.3.gz Binary files differnew file mode 100644 index 0000000..6e03a98 --- /dev/null +++ b/example_geoquery/grammar/grammar.3.gz diff --git a/example_geoquery/grammar/grammar.33.gz b/example_geoquery/grammar/grammar.33.gz Binary files differnew file mode 100644 index 0000000..4f58842 --- /dev/null +++ b/example_geoquery/grammar/grammar.33.gz diff --git a/example_geoquery/grammar/grammar.34.gz b/example_geoquery/grammar/grammar.34.gz Binary files differnew file mode 100644 index 0000000..a700a54 --- /dev/null +++ b/example_geoquery/grammar/grammar.34.gz diff --git a/example_geoquery/grammar/grammar.37.gz b/example_geoquery/grammar/grammar.37.gz Binary files differnew file mode 100644 index 0000000..32feb04 --- /dev/null +++ b/example_geoquery/grammar/grammar.37.gz diff --git a/example_geoquery/grammar/grammar.6.gz b/example_geoquery/grammar/grammar.6.gz Binary files differnew file mode 100644 index 0000000..bb24c62 --- /dev/null +++ b/example_geoquery/grammar/grammar.6.gz diff --git a/example_geoquery/run.sh b/example_geoquery/run.sh new file mode 100644 index 0000000..249c859 --- /dev/null +++ b/example_geoquery/run.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# memcached has to be running! +#memcached -p 31337 + +CDEC=/toolbox/cdec + +../rebol.rb \ + -k 100 \ + -i $(pwd)/data.in \ + -r $(pwd)/data.en \ + -g $(pwd)/data.gold \ + -h $(pwd)/data.funql \ + -w $(pwd)/../data/weights.init \ + -t $(pwd)/../data/stopwords.en \ + -c $(pwd)/cdec.ini \ + -b $(pwd)/cfg.rb \ + -o output-weights \ + -l \ + -e 0.01 \ + -j 1 \ + -u geoquery \ + -v rebol 2>output.stderr > output.stdout + +# translate test +$CDEC/decoder/cdec \ + -c cdec.ini \ + -w output-weights 2>/dev/null \ + < data.in \ + | ../scripts/geoquery/semparse.rb $(pwd)/cfg.rb \ + | ../scripts/geoquery/query.rb $(pwd)/cfg.rb > output-answers + +# evaluate result +../scripts/geoquery/eval.rb \ + data.gold < output-answers > output-eval + |