summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2013-04-18 13:11:05 +0000
committerhallgren <hallgren@chalmers.se>2013-04-18 13:11:05 +0000
commit5f35a59b95a85db3255dca8c163dcdbb7b15c1d2 (patch)
tree81d0d592f1fa466c4b18d4436753d391caa22f8c /src
parent6ae28fc6933d3fda2610f8dd6e9de95ea1fbe51a (diff)
gfrobust.js: add a method for constructing parse tree image URLs.
Diffstat (limited to 'src')
-rw-r--r--src/www/js/gfrobust.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/www/js/gfrobust.js b/src/www/js/gfrobust.js
index 327c77a98..fde72998b 100644
--- a/src/www/js/gfrobust.js
+++ b/src/www/js/gfrobust.js
@@ -3,12 +3,13 @@
var gfrobust = {}
-gfrobust.url="http://www.grammaticalframework.org:41296/robust-parser.cgi"
+gfrobust.url="http://www.grammaticalframework.org:41296/robust-parser/parse"
+gfrobust.jsonurl="http://www.grammaticalframework.org:41296/robust-parser.cgi"
gfrobust.grammar="Parse" // the name of the grammar
gfrobust.targetlist=[] // do not use, exposed only for debugging
gfrobust.call=function(querystring,cont) {
- http_get_json(gfrobust.url+querystring,cont)
+ http_get_json(gfrobust.jsonurl+querystring,cont)
}
// Translate a sentence to the given target language
@@ -17,7 +18,12 @@ gfrobust.translate=function(source,to,cont) {
gfrobust.call("?sentence="+enc(source)+"&to="+gfrobust.grammar+to,cont)
}
-// Get functions to test which source and target langauges are supports
+// Get the url of a parse tree image (SVG)
+gfrobust.parsetree_url=function(source) {
+ return gfrobust.url+"?sentence="+encodeURIComponent(source)
+}
+
+// Get functions to test which source and target langauges are supported
gfrobust.get_support=function(cont) {
function ssupport(code) { return code=="Eng" }
function tsupport(code) { return gfrobust.targets[code] }