From deb022716822815eb12297bb2a4a672372cf99c5 Mon Sep 17 00:00:00 2001 From: hallgren Date: Thu, 18 Apr 2013 13:11:05 +0000 Subject: [PATCH] gfrobust.js: add a method for constructing parse tree image URLs. --- src/www/js/gfrobust.js | 12 +++++++++--- 1 file 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] }