summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2015-03-18 16:23:04 +0000
committerhallgren <hallgren@chalmers.se>2015-03-18 16:23:04 +0000
commita120ed1e22c1fbeb7d8e2245e3b2355b051ce2f2 (patch)
treec02096ee0f6a617f9fd0b3a24cd34f9b906f1eb4
parent1c1e6bf00583534d9cdf98883316e1aa8c20cd3d (diff)
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.
-rw-r--r--src/www/js/wc.js12
1 files changed, 11 insertions, 1 deletions
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+"<br>"+(r.tree||"")
+ if(e) {
+ e.innerHTML=prob+"<br>"
+ 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) {