pax_global_header 0000666 0000000 0000000 00000000064 13526431417 0014520 g ustar 00root root 0000000 0000000 52 comment=c578098c240da184b3cfd2981fff78f78ca4db04
ud-kanbun-c578098c240da184b3cfd2981fff78f78ca4db04-conllusvg/ 0000775 0000000 0000000 00000000000 13526431417 0022520 5 ustar 00root root 0000000 0000000 ud-kanbun-c578098c240da184b3cfd2981fff78f78ca4db04-conllusvg/conllusvg/ 0000775 0000000 0000000 00000000000 13526431417 0024534 5 ustar 00root root 0000000 0000000 ud-kanbun-c578098c240da184b3cfd2981fff78f78ca4db04-conllusvg/conllusvg/18shilue.html 0000664 0000000 0000000 00000017472 13526431417 0027077 0 ustar 00root root 0000000 0000000
Universal Dependencies on 十八史略
十八史略
ud-kanbun-c578098c240da184b3cfd2981fff78f78ca4db04-conllusvg/conllusvg/Liji.html 0000664 0000000 0000000 00000023573 13526431417 0026323 0 ustar 00root root 0000000 0000000
Universal Dependencies on 禮記
禮記
ud-kanbun-c578098c240da184b3cfd2981fff78f78ca4db04-conllusvg/conllusvg/Lunyu.html 0000664 0000000 0000000 00000020765 13526431417 0026550 0 ustar 00root root 0000000 0000000
Universal Dependencies on 論語
論語
ud-kanbun-c578098c240da184b3cfd2981fff78f78ca4db04-conllusvg/conllusvg/Mencius.html 0000664 0000000 0000000 00000020575 13526431417 0027036 0 ustar 00root root 0000000 0000000
Universal Dependencies on 孟子定本
孟子定本
ud-kanbun-c578098c240da184b3cfd2981fff78f78ca4db04-conllusvg/conllusvg/Pulleyblank.html 0000664 0000000 0000000 00000006541 13526431417 0027712 0 ustar 00root root 0000000 0000000
Universal Dependencies on Pulleyblank's "Outline of Classical Chinese Grammar"
Universal Dependencies on Pulleyblank's "Outline of Classical Chinese Grammar"
ud-kanbun-c578098c240da184b3cfd2981fff78f78ca4db04-conllusvg/conllusvg/UDPipe2UD.py 0000775 0000000 0000000 00000005511 13526431417 0026554 0 ustar 00root root 0000000 0000000 #! /usr/bin/python -i
# "UDPipe2UD.py" by Koichi Yasuoka, July 3, 2019.
class UDPipeEntry(object):
def __init__(self,result):
if "\n" in result:
t=[UDPipeEntry("0\t_\t_\t_\t_\t_\t0\t_\t_\t_")]
for r in result.split("\n"):
w=UDPipeEntry(r)
if w.id>0:
t.append(w)
for i,w in enumerate(t):
w.head=w if w._head==0 else t[i+w._head-w.id]
w._parent=self
self._tokens=t
self._result=result
else:
w=result.split("\t")
try:
w[0],w[6]=int(w[0]),int(w[6])
except:
w=[0]*10
self.id,self.form,self.lemma,self.upos,self.xpos,self.feats,self._head,self.deprel,self.deps,self.misc=w if len(w)==10 else [0]*10
self._result=""
def __setattr__(self,name,value):
v=value
if hasattr(self,name):
if name=="head":
t=self._parent._tokens
i=t.index(self)
v=self if v==0 else t[i+v-self.id]
if getattr(self,name)!=v:
super(UDPipeEntry,self._parent).__setattr__("_result","")
if name=="id":
t=self._parent._tokens
i=t.index(self)
j=i+v-self.id
super(UDPipeEntry,t[j]).__setattr__("id",t[i].id)
t[i],t[j]=t[j],t[i]
super(UDPipeEntry,self).__setattr__(name,v)
def __repr__(self):
if self._result!="":
r=self._result
elif hasattr(self,"_tokens"):
r="".join(str(t)+"\n" for t in self._tokens[1:]).replace("\n1\t","\n\n1\t")
else:
r="\t".join([str(self.id),self.form,self.lemma,self.upos,self.xpos,self.feats,str(0 if self.head is self else self.head.id),self.deprel,self.deps,self.misc])
return r if type(r) is str else r.encode("utf-8")
def __getitem__(self,item):
return self._tokens[item]
def __len__(self):
return len(self._tokens)
def browse(self):
self.editor(url="http://kanji.zinbun.kyoto-u.ac.jp/~yasuoka/kyodokenkyu/ud-kanbun/conllusvg/viewer.svg")
def editor(self,url="http://kanji.zinbun.kyoto-u.ac.jp/~yasuoka/kyodokenkyu/ud-kanbun/conllusvg/editor.html"):
import webbrowser
try:
import urllib.parse
u=urllib.parse.quote(str(self))
except:
import urllib
u=urllib.quote(str(self))
webbrowser.open(url+"#"+u)
class UDPipe2UD(object):
def __init__(self,lang="ja",option="tokenizer=presegmented&tagger&parser"):
self.parseURL="http://lindat.mff.cuni.cz/services/udpipe/api/process?model="+lang+"&"+option
def __call__(self,sentence):
import json
s=sentence if type(sentence) is str else sentence.encode("utf-8")
try:
import urllib.request,urllib.parse
with urllib.request.urlopen(self.parseURL+"&data="+urllib.parse.quote(s)) as r:
q=r.read()
except:
import urllib,urllib2
r=urllib2.urlopen(self.parseURL+"&data="+urllib.quote(s))
q=r.read().decode("utf-8")
return UDPipeEntry(json.loads(q)["result"])
ud-kanbun-c578098c240da184b3cfd2981fff78f78ca4db04-conllusvg/conllusvg/conllusvgedit.js 0000664 0000000 0000000 00000046773 13526431417 0027775 0 ustar 00root root 0000000 0000000 // CoNLL-U SVG Edit by Koichi Yasuoka, July 6, 2019.
// "conllusvgview.js" is needed.
"use strict";
conllusvg.edit=function(svg,textid,deprelid,uposid,xposid){
var c=conllusvg.main[textid];
var g,t,i,j;
if(c==null){
conllusvg.view(svg,textid);
c=conllusvg.main[textid];
conllusvg.addMouseEvent(textid);
}
else
conllusvg.rewrite(textid);
if(deprelid!=null)
c.deprel=document.getElementById(deprelid).cloneNode(true);
else{
g=document.createElement("select");
t=["acl","advcl","advmod","amod","appos","aux","case","cc","ccomp","clf","compound","conj","cop","csubj","dep","det","discourse","dislocated","expl","fixed","flat","goeswith","iobj","list","mark","nmod","nsubj","nummod","obj","obl","orphan","parataxis","punct","reparandum","vocative","xcomp"];
for(i=0;in){
if(c.matrix[i-0.5]==null)
break;
i--;
}
if(i>n)
conllusvg.renum(textid,i);
}
conllusvg.esrap=function(textid){
var c=conllusvg.main[textid];
var tx=document.getElementById(textid);
var s="";
var i,j,k,m;
m=0;
for(i=0;i1;k--){
if(tl[i][k]!=null)
break;
}
a=tl[i][k].anchor;
f="";
for(x=k+1;xa)
tl[x][y].anchor+=s;
}
}
f="";
for(x=k+1;x=a)
tl[x][y].anchor+=s;
}
}
}
}
conllusvg.writeSelect=function(textid,g,t){
var c=conllusvg.main[textid];
var r,i;
g.style.position="absolute";
g.style.left=(conllusvg.getLeft()+c.event.handler.clientX)+"px";
g.style.top=(conllusvg.getTop()+c.event.handler.clientY)+"px";
document.body.appendChild(g);
r=g.getBoundingClientRect();
i=conllusvg.getLeft()+(r.left*3-r.right)/2
g.style.left=((i<0)?0:i)+"px";
i=conllusvg.getTop()+r.top*2-r.bottom;
g.style.top=((i<0)?0:i)+"px";
g.style.visibility="visible";
g.addEventListener("click",conllusvg.onClickSelect);
g.addEventListener("keydown",conllusvg.onKeyDownSelect);
c.event.select=g;
c.event.selectType=t;
g.focus();
conllusvg.timer=setTimeout("clearTimeout(conllusvg.timer);conllusvg.main['"+textid+"'].event.select.focus()",0);
}
conllusvg.clickDeprel=function(textid){
var c=conllusvg.main[textid];
var g=c.event.select;
var ix=g.selectedIndex;
var t;
if(ix>=0){
t=g.options[ix].value;
if(t==null||t==""||t==g.options[ix].textContent)
t="conllusvg.setDeprel";
conllusvg.timer=setTimeout("clearTimeout(conllusvg.timer);"+t+"('"+textid+"','"+g.options[ix].textContent+"')",0);
}
g.removeEventListener("click",conllusvg.onClickSelect);
g.removeEventListener("keydown",conllusvg.onKeyDownSelect);
document.body.removeChild(g);
c.event.select=null;
}
conllusvg.clickUpos=function(textid){
var c=conllusvg.main[textid];
var g=c.event.select;
var ix=g.selectedIndex;
var t;
if(ix>=0){
t=g.options[ix].value;
if(t==null||t==""||t==g.options[ix].textContent)
t="conllusvg.setUpos";
conllusvg.timer=setTimeout('clearTimeout(conllusvg.timer);'+t+'("'+textid+'","'+g.options[ix].textContent+'")',0);
}
g.removeEventListener("click",conllusvg.onClickSelect);
g.removeEventListener("keydown",conllusvg.onKeyDownSelect);
document.body.removeChild(g);
c.event.select=null;
}
conllusvg.clickXpos=function(textid){
var c=conllusvg.main[textid];
var g=c.event.select;
var t=c.event.index;
var ix=g.selectedIndex;
var s;
if(ix>=0){
s=c.nodes[t].xpostag=g.options[ix].textContent;
conllusvg.insertTextline(textid,c.nodes[t].textlineid,5,s);
conllusvg.writeNodesSVG(textid);
}
g.removeEventListener("click",conllusvg.onClickSelect);
g.removeEventListener("keydown",conllusvg.onKeyDownSelect);
document.body.removeChild(g);
c.event.select=null;
}
conllusvg.clickLink=function(textid){
var c=conllusvg.main[textid];
var ix=c.event.index;
var g,r,i;
if(c.event.startNode!=null)
return;
if(c.nodes[ix].head==0)
return;
if(c.event.redLink!=null){
c.links[c.event.redLink].svg.setAttribute("stroke","black");
c.links[c.event.redLink].svg.setAttribute("fill","black");
}
c.links[ix].svg.setAttribute("stroke","red");
c.links[ix].svg.setAttribute("fill","red");
c.event.redLink=ix;
if(c.event.select!=null){
c.event.select.removeEventListener("click",conllusvg.onClickSelect);
c.event.select.removeEventListener("keydown",conllusvg.onKeyDownSelect);
document.body.removeChild(c.event.select);
c.event.select=null;
}
g=c.deprel.cloneNode(true);
for(i=g.options.length-1;i>=0;i--){
if(g.options[i].textContent==c.nodes[ix].deprel)
break;
}
g.selectedIndex=i;
conllusvg.writeSelect(textid,g,"deprel");
}
conllusvg.clickNode=function(textid){
var c=conllusvg.main[textid];
if(c.event.startNode==null)
conllusvg.clickNodeStart(textid);
else if(c.event.startNode!=c.event.index)
conllusvg.clickNodeEnd(textid);
else
conllusvg.clickNodeDouble(textid);
}
conllusvg.clickNodeStart=function(textid){
var c=conllusvg.main[textid];
var r=c.svg.getBoundingClientRect();
if(c.event.select!=null){
c.event.select.removeEventListener("click",conllusvg.onClickSelect);
c.event.select.removeEventListener("keydown",conllusvg.onKeyDownSelect);
document.body.removeChild(c.event.select);
c.event.select=null;
}
if(c.event.redLink!=null){
c.links[c.event.redLink].svg.setAttribute("stroke","black");
c.links[c.event.redLink].svg.setAttribute("fill","black");
c.event.redLink=null;
}
c.event.startNode=c.event.index;
c.event.startX=c.event.handler.clientX-r.left;
c.event.startY=c.event.handler.clientY-r.top;
c.svg.addEventListener("mousemove",conllusvg.onMouseMove);
}
conllusvg.clickNodeEnd=function(textid){
var c=conllusvg.main[textid];
var f=c.event.startNode;
var t=c.event.index;
c.event.startNode=null;
if(c.event.redArrow!=null){
c.svg.removeChild(c.event.redArrow);
c.svg.removeChild(c.event.redTriangle);
c.event.redArrow=c.event.redTriangle=null;
}
c.svg.removeEventListener("mousemove",conllusvg.onMouseMove);
c.nodes[t].head=c.nodes[f].id;
if(c.links[t]==null){
c.links[t]=new Object();
c.links[t].deprel=c.nodes[t].deprel;
}
c.links[t].from=f;
conllusvg.insertTextline(textid,c.nodes[t].textlineid,7,c.nodes[f].id);
if(c.nodes[t].deprel=="root"){
c.nodes[t].deprel=c.links[t].deprel="_";
conllusvg.insertTextline(textid,c.nodes[t].textlineid,8,"_");
}
conllusvg.clearSVG(textid);
if(f-t!=c.nodes[f].id-c.nodes[t].id){
conllusvg.renum(textid);
conllusvg.esrap(textid);
conllusvg.reparse(textid);
}
else{
conllusvg.makeLinks(textid);
c.width=null;
conllusvg.rewrite(textid);
}
if(c.links[t].svg!=null){
c.links[t].svg.setAttribute("stroke","red");
c.links[t].svg.setAttribute("fill","red");
c.event.redLink=t;
if(c.nodes[t].deprel=="_"){
c.event.index=t;
conllusvg.writeSelect(textid,c.deprel.cloneNode(true),"deprel");
}
}
}
conllusvg.clickNodeDouble=function(textid){
var c=conllusvg.main[textid];
var ix=c.event.index;
if(c.event.redArrow!=null){
c.svg.removeChild(c.event.redArrow);
c.svg.removeChild(c.event.redTriangle);
c.event.redArrow=c.event.redTriangle=null;
}
c.svg.removeEventListener("mousemove",conllusvg.onMouseMove);
c.event.startNode=null;
if(c.event.select!=null){
c.event.select.removeEventListener("click",conllusvg.onClickSelect);
c.event.select.removeEventListener("keydown",conllusvg.onKeyDownSelect);
document.body.removeChild(c.event.select);
c.event.select=null;
}
conllusvg.writeSelect(textid,c.upos.cloneNode(true),"upos");
}
conllusvg.checkXpos=function(textid){
var c=conllusvg.main[textid];
var ix=c.event.index;
var g=document.createElement("select");
var i,k;
k=0;
for(i=0;i1){
g.size=(c.xpos.size