Commit 366abe6e authored by Koichi Yasuoka's avatar Koichi Yasuoka
Browse files

rather strict nmod-nummod check

parent 5027bf97
Loading
Loading
Loading
Loading
+63 −59
Original line number Diff line number Diff line
<!DOCTYPE html><head><meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>CoNLL-U SVG Editor for 漢文 by 安岡孝一, April 14, 2019.</title>
<title>CoNLL-U SVG Editor for 漢文 by 安岡孝一, April 27, 2019.</title>
<script src="conllusvgview.js"></script>
<script src="conllusvgedit.js"></script>
<script src="conllusvgload.js"></script>
@@ -253,45 +253,7 @@ conllusvg.kanbun.checkLinks=function(textid){
      d=c.links[t].deprel;
      f=c.links[t].from;
      p=0;
      if(p==0&&(d=="ccomp"||d=="csubj"||d=="advcl"||d=="acl")){
	p=1;
	for(x in c.links){
	  if(c.links[x].from==t){
	    p=0;
	    break;
	  }
	}
      }
      if(p==0&&d=="mark"){
	p=1;
	for(x in c.links){
	  if(t!=x&&c.links[x].from==f){
	    p=0;
	    break;
	  }
	}
      }
      if(p==0&&(d=="nsubj"||d=="obj"||d=="obl"||d=="amod"||d=="advmod")){
	for(x in c.links){
	  if(c.links[x].from==t){
	    k=c.links[x].deprel;
	    if(k=="nsubj"||k=="obj"||k=="obl"||k=="aux"){
	      p=1;
	      break;
	    }
	  }
	}
      }
      if(p==0&&d=="case"){
	for(x in c.links){
	  if(c.links[x].from==f){
	    k=c.links[x].deprel;
	    if(k=="nsubj"||k=="obj"||k=="obl"||k=="aux"){
	      p=1;
	      break;
	    }
	  }
	}
	if(c.links[f]!=null){
	  if(c.links[f].from-f<0){
	    k=c.nodes[f].deprel;
@@ -304,33 +266,21 @@ conllusvg.kanbun.checkLinks=function(textid){
	if(c.nodes[f].deprel!="conj")
	  p=1;
      }
      if(p==0&&d=="xcomp"){
	p=1;
	for(x in c.links){
	  if(c.links[x].from==f){
	    k=c.links[x].deprel;
	    if(k=="obj"||k=="expl"||k=="ccomp"){
	      p=0;
	      break;
	    }
	  }
	}
      }
      if(p==0&&(d=="nmod"||d=="clf"||d=="compound"||d=="flat")){
      if(p==0&&d=="nmod"){
        k=c.nodes[t].upostag;
	if(k=="NOUN"||k=="PROPN"||k=="NUM"||k=="PART"||k=="SYM")
	if(k=="NOUN"||k=="PROPN"||k=="PART"||k=="SYM")
	  p=0;
	else
	  p=1;
      }
      if(p==0&&d=="det"){
      if(p==0&&(d=="clf"||d=="compound"||d=="flat")){
        k=c.nodes[t].upostag;
	if(k=="PRON")
	if(k=="NOUN"||k=="PROPN"||k=="NUM")
	  p=0;
	else
	  p=1;
      }
      if(p==0&&d=="expl"){
      if(p==0&&(d=="det"||d=="expl")){
        k=c.nodes[t].upostag;
	if(k=="PRON")
	  p=0;
@@ -376,14 +326,68 @@ conllusvg.kanbun.checkLinks=function(textid){
	else
	  p=1;
      }
      if(p==0&&(d=="flat:vv"||d=="flat"||d=="compound")){
      if(p==0&&(d=="flat:vv"||d=="flat"||d=="compound"||d=="conj")){
	if(f-t==1||t-f==1){
	  if(c.nodes[f].form==c.nodes[t].form)
	    p=1;
	}
      }
      if(p==0&&d=="compound:redup"){
	if(c.nodes[f].form!=c.nodes[t].form)
	  p=1;
      }
      if(p==0&&(d=="ccomp"||d=="csubj"||d=="advcl"||d=="acl")){
	p=1;
	for(x in c.links){
	  if(c.links[x].from==t){
	    p=0;
	    break;
	  }
	}
      }
      if(p==0&&d=="mark"){
	p=1;
	for(x in c.links){
	  if(t!=x&&c.links[x].from==f){
	    p=0;
	    break;
	  }
	}
      }
      if(p==0&&(d=="nsubj"||d=="obj"||d=="obl"||d=="amod"||d=="advmod")){
	for(x in c.links){
	  if(c.links[x].from==t){
	    k=c.links[x].deprel;
	    if(k=="nsubj"||k=="obj"||k=="obl"||k=="aux"){
	      p=1;
	      break;
	    }
	  }
	}
      }
      if(p==0&&d=="case"){
	for(x in c.links){
	  if(c.links[x].from==f){
	    k=c.links[x].deprel;
	    if(k=="nsubj"||k=="obj"||k=="obl"||k=="aux"){
	      p=1;
	      break;
	    }
	  }
	}
      }
      if(p==0&&d=="xcomp"){
	p=1;
	for(x in c.links){
	  if(c.links[x].from==f){
	    k=c.links[x].deprel;
	    if(k=="obj"||k=="expl"||k=="ccomp"){
	      p=0;
	      break;
	    }
	  }
	}
      }
      if(p==1){
	c.links[t].svg.setAttribute("stroke","pink");
	c.links[t].svg.setAttribute("fill","pink");