Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*!
* vakyartha dependency script 1.1
* http://arborator.ilpga.fr/
*
* Copyright 2010, Kim Gerdes
*
* This program is free software:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and limitations under the License.
*
*/
///////////////////////// parameters ////////////////
////////////////////////////////////////////////////
tab=8; // space between tokens
line=25; // line height
dependencyspace=180; // y-space for dependency representation
xoff=8; // placement of the start of a depdency link in relation to the center of the word
linedeps=15; // y distance between two arrows arriving at the same token (rare case)
pois=4; // size of arrow pointer
tokdepdist=15; // distance between tokens and depdendency relation
funccurvedist=8; // distance between the function name and the curves highest point
depminh = 20; // minimum height for dependency
worddistancefactor = 8; // distant words get higher curves. this factor fixes how much higher.
defaultattris={
"font": '14px "Arial"',
"text-anchor":'start'
};
attris = {
"t": {
"font": '18px "Arial"',
"text-anchor":'start'
},
"cat": {
"font": '14px "Times"',
"text-anchor":'start',
"fill": '#036'
},
"lemma": {
"font": '14px "Times"',
"text-anchor":'start',
"fill": '#036'
},
"depline": {
"stroke": '#999',
"stroke-width":'1'
},
"deptext": {
"font": '12px "Times"',
"font-style":'italic',
"fill": '#999'
},
"form": {
"font-style":'italic'
}
};
///////////////////////// node object and functions ////////////////
////////////////////////////////////////////////////////////////////
function Pnode(c,b){
this.index=c;
this.govs={};
if("govs"in b) {this.govs=b["govs"];}
this.width=0;
this.texts=new Object();
this.svgs=new Object();
var d=dependencyspace;
for (var h in shownfeatures){
var e=shownfeatures[h];
this.texts[e]= b[e];
var f=paper.text(currentx,d,b[e]);
f.attr(defaultattris);
f.attr("title", b.tooltip);
if(e in b)f.attr(attris[e]);
if("attris"in b)f.attr(b["attris"][e]);
var g=f.getBBox().width;
f.width=g;
f.index=c;
this.svgs[e]=f;
if(g>this.width)this.width=g;
d=d+line;
}
svgwi=svgwi+this.width+tab;
this.x=0;
this.y=0;
this.svgdep={};
this.deplineattris={};
this.deptextattris={};
if("attris"in b&&"depline"in b["attris"])this.deplineattris=b["attris"]["depline"];
if("attris"in b&&"deptext"in b["attris"])this.deptextattris=b["attris"]["deptext"];
}
drawsvgDep=function(c,b,d,h,e,f,g,i,p){
var l=paper.set();
var q=Math.abs(d-e)/2;
var m=Math.max(h-q-worddistancefactor*Math.abs(c-b),-tokdepdist);
m=Math.min(m,h-depminh);
var r="M"+d+","+h+"C"+d+","+m+" "+e+","+m+" "+e+","+f;
var j=paper.path(r).attr(attris["depline"]).attr({
"x":d,
"y":h
});
var n=paper.pointer(e,f,pois,0).attr(attris["depline"]);
a=j.getPointAtLength(j.getTotalLength()/2);
t=paper.text(a.x,a.y-funccurvedist,g);
t.attr(attris["deptext"]);
t.attr(p);
t.index=c;
t.govind=b;
if(c==b){
var k=a.x+t.getBBox().width/2+funccurvedist/2;
if(k+t.getBBox().width/2>svgwi)k=a.x-t.getBBox().width/2-funccurvedist/2;
if(k-t.getBBox().width/2<0)k=a.x;
t.attr("x",k);
}
if(g in fcolors){
var o="#"+fcolors[g];
j.attr({
stroke:o
});
n.attr({
stroke:o
});
t.attr({
fill:o
});
}
j.attr(i);
n.attr(i);
l.push(t);
l.push(j);
l.push(n);
return l;
};
drawDep=function(c,b,d,h)
{
c=parseInt(c);
var e;
var f;
var g;
var i;
if(b=="root")
{
b=c;
node2=words[c];
e=node2.svgs[shownfeatures[0]].attr("x")+node2.svgs[shownfeatures[0]].width/2;
f=node2.svgs[shownfeatures[0]].attr("y")-tokdepdist;
g=e;
i=0;
}
else
{
b=parseInt(b);
var node1=words[b];
var node2=words[c];
if(node1==null)
{
delete node2.govs[b];
return;
}
if(c