From e92583ca8ccd347c87af2a11eee65b7d2a6c1e73 Mon Sep 17 00:00:00 2001 From: hallgren Date: Wed, 18 Mar 2015 16:23:04 +0000 Subject: [PATCH] Wide Coverage Translation Demo: draw syntax trees The trees are drawn by using the Haskell run-time request AppEng.pgf?command=abstrtree&tree=... Thus AppEng.pgf has to be installed on the server and in sync with App14.pgf. This is to avoid loading the huge App14.pgf in the Haskell run-time system, and is enough since we only need the abstract syntax. --- src/www/js/wc.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/www/js/wc.js b/src/www/js/wc.js index 2a9f1624c..a858ada0a 100644 --- a/src/www/js/wc.js +++ b/src/www/js/wc.js @@ -110,7 +110,17 @@ wc.translate=function() { wc.selected=so var r=so.rs[so.current_pick] var prob=r.prob<=0 ? "" : r.prob || "" - if(e) e.innerHTML=prob+"
"+(r.tree||"") + if(e) { + e.innerHTML=prob+"
" + if(r.tree) { + var t=wrap("span",text(r.tree)) + var imgurl="/robust/AppEng.pgf?command=abstrtree&tree="+encodeURIComponent(r.tree)+"&format=svg" + e.appendChild(t) + if(!r.img) r.img=node("img",{src:imgurl},[]) + e.appendChild(empty("br")) + e.appendChild(r.img) + } + } if(wc.p /*&& so.rs.length>1*/) show_picks() //if(f.speak.checked) wc.speak(t.text,f.to.value) if(!so.got_more) {