Skip to content

Commit

Permalink
Add PDT-C-specific changes to the Show trees visualization.
Browse files Browse the repository at this point in the history
  • Loading branch information
foxik committed Nov 20, 2023
1 parent 7c3c0d8 commit a0246ae
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions web/lindat-service/run.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ function showTree() {
var tree_desc = [];
var tree_nodes = [];

var is_pdtc = output_file_content.indexOf("\n# udpipe_model = czech-pdtc") >= 0
var lines = output_file_content.split(/\r?\n/);
lines.push('');
for (var i in lines) {
Expand All @@ -134,12 +135,16 @@ function showTree() {

if (tree_desc.length) tree_desc.push([' ', 'space']);
tree_desc.push([parts[1], 'w'+parts[0]]);

if (!tree_nodes.length) tree_nodes.push({id:'w0', ord:0, parent:null, data:{id:"0",form:"<root>"}, labels:['<root>','','']});
if (!tree_nodes.length) {
if (is_pdtc)
tree_nodes.push({id:'w0', ord:0, parent:null, data:{id:"0",deprel:"AuxS"}, labels:['#{#00008b}AuxS','','']});
else
tree_nodes.push({id:'w0', ord:0, parent:null, data:{id:"0",form:"<root>"}, labels:['<root>','','']});
}
tree_nodes.push({id:'w'+parts[0], ord:tree_nodes.length, parent:parts[6]!==""?'w'+parts[6]:null, data:{
id:parts[0], form:parts[1], lemma:parts[2], upostag:parts[3], xpostag:parts[4],
feats:parts[5], head:parts[6], deprel:parts[7], deps:parts[8], misc:parts[9]
}, labels:[parts[1], '#{#00008b}'+parts[7], '#{#004048}'+parts[3]]});
}, labels:[parts[1], '#{#00008b}'+parts[7], '#{#004048}'+(is_pdtc ? parts[4].replace(/-*$/, "") : parts[3])]});
} else if (tree_nodes.length) {
var last_child = [];
for (var i = 1; i < tree_nodes.length; i++) {
Expand Down

0 comments on commit a0246ae

Please sign in to comment.