Commit b4902c0b authored by Koichi Yasuoka's avatar Koichi Yasuoka
Browse files

bug fix for non-projective links

parent ede8ba4a
Loading
Loading
Loading
Loading
+36 −2
Original line number Diff line number Diff line
// CoNLL-U SVG Viewer by Koichi Yasuoka, December 16, 2018.
// CoNLL-U SVG Viewer by Koichi Yasuoka, February 6, 2019.
// Nos. 1, 2, 4, 5, 7, and 8 columns are used.
"use strict";
var conllusvg=new Object();
@@ -335,6 +335,40 @@ conllusvg.makeHeight=function(textid){
	c.matrix[i][x].height=h;
    }
  }
  for(x in c.links){
    y=c.links[x].from;
    if(x==y)
      continue;
    h=c.matrix[x][x].height;
    for(k in c.matrix[x]){
      if(k!=x&&h==c.matrix[x][k].height){
	if(c.links[k].from!=x){
	  h=-1;
	  break;
	}
      }
    }
    if(h==-1){
      for(k in c.matrix[x]){
	if(h-c.matrix[x][k].height<0)
	  h=c.matrix[x][k].height;
      }
      h++;
      if(x-y<0){
        j=parseInt(x);
        k=parseInt(y);
      }
      else{
        j=parseInt(y);
        k=parseInt(x);
      }
      g=c.nodes[x].group;
      for(i=j;i<=k;i++){
	if(c.nodes[i].group==g)
	  c.matrix[i][x].height=h;
      }
    }
  }
  for(x in c.links){
    y=c.links[x].from;
    if(x==y){