diff options
| author | hallgren <hallgren@chalmers.se> | 2016-06-09 13:12:14 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2016-06-09 13:12:14 +0000 |
| commit | 096b4cfceea03007ae1ac7d46080c2a5f8e99688 (patch) | |
| tree | 58ce3c746cc1782d6a69022781586cf9103c647d /src/www | |
| parent | 617624e2a81ec00dd5484a7e0ee7ca8f21a3ffff (diff) | |
PGF service & minibar: only show dependency diagrams if the labels are known
+ The PGF service now reads and caches dependency label configuration files.
+ The grammar info returned by command=grammar has a new boolean field
'hasDependencyLabels' to indicate if dependency labels were found for
the grammar. Also, command=deptree will now fail if no labels are present.
+ The minibar only shows word dependency trees if labels are present.
+ Also changed the type of getDepLabels from [String] -> Labels to
String -> Labels, since all uses were in the form "getDepLabels . lines".
Diffstat (limited to 'src/www')
| -rw-r--r-- | src/www/minibar/minibar_translations.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/www/minibar/minibar_translations.js b/src/www/minibar/minibar_translations.js index 01b4d21dd..66bd5bd18 100644 --- a/src/www/minibar/minibar_translations.js +++ b/src/www/minibar/minibar_translations.js @@ -135,7 +135,7 @@ Translations.prototype.show_translations=function(translationResults) { var ts = text_speech(langcode,to,txt,lin) var as = wrap("span", self.options.show_trees - ? [self.parsetree_button(tree,to),text(" "),ts] + ? [self.parsetree_button(tree,to,self.grammar),text(" "),ts] : [ts]) as.active=txt as.swap=ts @@ -225,7 +225,7 @@ Translations.prototype.show_translations=function(translationResults) { var hdr=title("Switch input language to "+langcode, button(langcode,act(lin[i]))) //hdr.disabled=lin[i].to==current.from - var btn=parsetree_button(t.tree,lin[i].to) + var btn=parsetree_button(t.tree,lin[i].to,grammar) tbody.appendChild( tr([th(hdr),show_lin(langcode,lin[i],t.tree)])); } @@ -288,14 +288,14 @@ Translations.prototype.alignment_button=function(abs,all,toLangs) { return i; } -Translations.prototype.parsetree_button=function(abs,lang) { +Translations.prototype.parsetree_button=function(abs,lang,grammar) { var f=this.options.tree_img_format; var img=this.server.current_grammar_url +"?command=parsetree&format="+f+"&nodep=true&nodefont=arial" +"&from="+lang+"&tree="+encodeURIComponent(abs); var img_nofun=img+"&nofun=true" var help="Click again to display parse tree. Click again to show function names." - if(f=="svg") { + if(f=="svg" && grammar.hasDependencyLabels) { var depimg=this.server.current_grammar_url +"?command=deptree&format=svg&to="+lang +"&tree="+encodeURIComponent(abs); |
