mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
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.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user