Changeset acbabee for src/dgp/sgraph.cc
- Timestamp:
- 12/17/14 12:13:11 (10 years ago)
- Branches:
- master
- Children:
- 854bece
- Parents:
- d484a32
- git-author:
- Tomasz Obrebski <obrebski@…> (12/17/14 12:10:45)
- git-committer:
- Tomasz Obrebski <obrebski@…> (12/17/14 12:13:11)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/dgp/sgraph.cc
rd484a32 racbabee 1 #include "global.hh"2 1 #include "sgraph.hh" 3 2 #include "grammar.hh" … … 16 15 newnode.mnode=mnodeind; 17 16 18 for(vector<int>::iterator pm=mgraph[newnode.mnode].pred.begin(); pm!=mgraph[newnode.mnode].pred.end(); ++pm)19 for(vector<int>::iterator ps=mgraph[*pm].snodes.begin(); ps!=mgraph[*pm].snodes.end(); ++ps)20 if(nodes[*ps].in_LH)21 {22 newnode.LV.set(*ps);23 if(nodes[*ps].saturated()) newnode.LV |= nodes[*ps].LH;24 }17 // for(vector<int>::iterator pm=mgraph[newnode.mnode].pred.begin(); pm!=mgraph[newnode.mnode].pred.end(); ++pm) 18 // for(vector<int>::iterator ps=mgraph[*pm].snodes.begin(); ps!=mgraph[*pm].snodes.end(); ++ps) 19 // if(nodes[*ps].in_LH) 20 // { 21 // newnode.LV.set(*ps); 22 // if(nodes[*ps].saturated()) newnode.LV |= nodes[*ps].LH; 23 // } 25 24 26 25 mgraph[newnode.mnode].snodes.push_back(lastnodeind()); 27 26 28 newnode.in_LH=true;27 // newnode.in_LH=true; 29 28 30 newnode.edge.push_back(lastnodeind());29 // newnode.edge.push_back(lastnodeind()); 31 30 32 newnode.edge _contains_self = true;31 newnode.edge.insert_self(); 33 32 34 33 return lastnodeind(); … … 55 54 //==================================================================================================== 56 55 57 int SGraph::clone(int ancind, NodeProp newprop )56 int SGraph::clone(int ancind, NodeProp newprop, Edge edge) 58 57 { 59 58 SNode &newnode=makenewnode(); 60 59 SNode &ancnode = nodes[ancind]; 61 60 62 newnode.prop=newprop; 63 newnode.mnode=ancnode.mnode; 61 newnode.prop = newprop; 62 newnode.edge = edge; 63 newnode.mnode = ancnode.mnode; 64 64 mgraph[newnode.mnode].snodes.push_back(lastnodeind()); 65 65 … … 90 90 { 91 91 if(dir==0) 92 fprintf(f,"%s %s:%d <-- %d\n", msg, role.str(), dep, head);92 fprintf(f,"%s\t%d <-- %d\t%s\n", msg, dep, head, role.str()); 93 93 else 94 fprintf(f,"%s %s:%d --> %d\n", msg, role.str(), head, dep);94 fprintf(f,"%s\t%d --> %d\t%s\n", msg, head, dep, role.str()); 95 95 } 96 96 … … 172 172 { 173 173 char *buf0 = buf; 174 buf+=sprintf(buf,"%- 10s",pref);174 buf+=sprintf(buf,"%-8s",pref); 175 175 buf+=sprintf(buf,"%d.%s",n,form(n)); 176 176 buf+=sprintf(buf,";"); 177 177 buf+=sprintf(buf,"%s ",cat(n).str()); 178 178 while(buf-buf0<40) buf+=sprintf(buf," "); 179 buf+=sprint_node(buf,n,anc,HEADS|DEPS| SETS|CONSTRAINTS);179 buf+=sprint_node(buf,n,anc,HEADS|DEPS|CONSTRAINTS); 180 180 181 181 buf+=sprintf(buf,"/"); 182 for(vector<int>::iterator e = nodes[n].edge.begin(); e != nodes[n].edge.end(); e++ ) 182 if(nodes[n].edge.self()) 183 buf += sprintf(buf,"* "); 184 for(list<int>::iterator e = nodes[n].edge.others().begin(); e != nodes[n].edge.others().end(); e++ ) 183 185 buf += sprintf(buf,"%d ", *e); 184 186
Note: See TracChangeset
for help on using the changeset viewer.