drobiazgi w dgp

This commit is contained in:
Tomasz Obrebski 2013-11-19 09:55:00 +01:00 committed by Tomasz Obrebski
parent e0cd003326
commit b97a55609b
4 changed files with 21 additions and 15 deletions

View File

@ -172,7 +172,7 @@ int create_new_head_node_left(int h, NodeProp& newheadprop, bitset<MAXNODES>& ne
create_reverse_links(newheadind); create_reverse_links(newheadind);
if(debug) sgraph.print_node_debug(stderr,"C ",newheadind,h); if(debug) sgraph.print_node_debug(stderr,"C ",newheadind,h);
if(debug) print_sets(newheadind); // if(debug) print_sets(newheadind);
return newheadind; return newheadind;
} }
@ -191,7 +191,7 @@ int create_new_dep_node_left(int d, NodeProp& prop, bitset<MAXNODES>& LH, bitset
create_reverse_links(newind); create_reverse_links(newind);
if(debug) sgraph.print_node_debug(stderr,"C ",newind,d); if(debug) sgraph.print_node_debug(stderr,"C ",newind,d);
if(debug) print_sets(newind); // if(debug) print_sets(newind);
return newind; return newind;
} }
@ -211,7 +211,7 @@ int create_new_head_node_right(int h, NodeProp& newheadprop, bitset<MAXNODES>& n
create_reverse_links(newheadind); create_reverse_links(newheadind);
if(debug) sgraph.print_node_debug(stderr,"C ",newheadind,h); if(debug) sgraph.print_node_debug(stderr,"C ",newheadind,h);
if(debug) print_sets(newheadind); // if(debug) print_sets(newheadind);
return newheadind; return newheadind;
} }
@ -229,7 +229,7 @@ int create_new_dep_node_right(int d, NodeProp& prop, bitset<MAXNODES>& LH, bitse
create_reverse_links(newind); create_reverse_links(newind);
if(debug) sgraph.print_node_debug(stderr,"C ",newind,d); if(debug) sgraph.print_node_debug(stderr,"C ",newind,d);
if(debug) print_sets(newind); // if(debug) print_sets(newind);
return newind; return newind;
} }
@ -303,9 +303,9 @@ void connect_left(int h, int d, const Link& l, list<Boubble*>& new_head_boubbles
if(debug) sgraph.print_arc(stderr,newheadind,d,l.role,0); if(debug) sgraph.print_arc(stderr,newheadind,d,l.role,0);
if(debug) sgraph.print_node_debug(stderr,"U ",newheadind,h); if(debug) sgraph.print_node_debug(stderr,"U ",newheadind,h);
if(debug) print_sets(newheadind); // if(debug) print_sets(newheadind);
if(debug) sgraph.print_node_debug(stderr,"U ",newdepind,d); if(debug) sgraph.print_node_debug(stderr,"U ",newdepind,d);
if(debug) print_sets(newdepind); // if(debug) print_sets(newdepind);
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------

View File

@ -112,16 +112,20 @@ int SGraph::sprint_node(char* buf, int nodeind, int anc, unsigned int info)
if (info&HEADS) if (info&HEADS)
for(vector<Arc>::iterator h=node.heads.begin(); h!=node.heads.end(); ++h) for(vector<Arc>::iterator h=node.heads.begin(); h!=node.heads.end(); ++h)
{ {
if(cont) buf+=sprintf(buf,","); else cont=true; // if(cont) buf+=sprintf(buf,","); else cont=true;
buf+=sprintf(buf,"++%s-%d(%d~%d)",h->role.str(),h->dst,h->headanc,h->depanc); buf+=sprintf(buf,"(++%s:%d)",h->role.str(),h->dst);
// buf+=sprintf(buf,"++%s-%d(%d~%d)",h->role.str(),h->dst,h->headanc,h->depanc);
// buf+=sprintf(buf,"(<-%s-%d)",h->role.str(),h->dst);
} }
if (info&DEPS) if (info&DEPS)
for(vector<Arc>::iterator d=node.deps.begin(); d!=node.deps.end(); ++d) for(vector<Arc>::iterator d=node.deps.begin(); d!=node.deps.end(); ++d)
{ {
// if(! nodes[d->dst].saturated()) continue; // NIE DRUKUJ NIENASYCONYCH PODRZEDNIKOW // if(! nodes[d->dst].saturated()) continue; // NIE DRUKUJ NIENASYCONYCH PODRZEDNIKOW
if(cont) buf+=sprintf(buf,","); else cont=true; // if(cont) buf+=sprintf(buf,","); else cont=true;
buf+=sprintf(buf,"--%s-%d(%d~%d)",d->role.str(),d->dst,d->headanc,d->depanc); buf+=sprintf(buf,"(--%s:%d)",d->role.str(),d->dst);
// buf+=sprintf(buf,"--%s-%d(%d~%d)",d->role.str(),d->dst,d->headanc,d->depanc);
// buf+=sprintf(buf,"(-%s->%d)",d->role.str(),d->dst);
} }
if (info&SETS) if (info&SETS)

View File

@ -20,7 +20,7 @@ opts = GetoptLong.new(
$helptext= $helptext=
"The program generates trees from the graph output by dgp. dgp must\n"+ "The program generates trees from the graph output by dgp. dgp must\n"+
"must be run with '-i ds' option.\n\n"+ "must be run with '--info=ds' option.\n\n"+
"Command: tre [options]\n\n"+ "Command: tre [options]\n\n"+
"Options:\n"+ "Options:\n"+
"--help -h Print help (this text) and exit.\n"+ "--help -h Print help (this text) and exit.\n"+
@ -268,7 +268,7 @@ def parsegraph(nodes)
parts = dgp[2].split($dgpsep,7) parts = dgp[2].split($dgpsep,7)
if parts[3]==nil || parts[4]==nil || parts[5]==nil if parts[3]==nil || parts[4]==nil || parts[5]==nil
$stderr.print "ERR: tre requires dgp be called with '--info s' option. Aborting.\n" $stderr.print "ERR: tre requires dgp be called with '--info=ds' option. Aborting.\n"
exit exit
end end
@ -279,9 +279,11 @@ def parsegraph(nodes)
$arcs |= parts[2].split(',').map{ |a| case a $arcs |= parts[2].split(',').map{ |a| case a
when /\-\-(\w+)-(\d+)\((\d+)~(\d+)\)/ when /\-\-(\w+)-(\d+)\((\d+)~(\d+)\)/
[i, $2.to_i, $1, $3.to_i, $4.to_i] # [i, $2.to_i, $1, $3.to_i, $4.to_i]
[i, $2.to_i, $1, 0, 0]
when /\+\+(\w+)-(\d+)\((\d+)~(\d+)\)/ when /\+\+(\w+)-(\d+)\((\d+)~(\d+)\)/
[$2.to_i, i, $1, $3.to_i, $4.to_i] # [$2.to_i, i, $1, $3.to_i, $4.to_i]
[$2.to_i, i, $1, 0, 0]
end } end }
$succ |= parts[3][1..-2].split(',').map{|x| [x.to_i,i]} $succ |= parts[3][1..-2].split(',').map{|x| [x.to_i,i]}
$vis |= parts[4][1..-2].split(',').map{|x| [x.to_i,i]} $vis |= parts[4][1..-2].split(',').map{|x| [x.to_i,i]}