- Timestamp:
- 03/30/14 23:59:06 (11 years ago)
- Branches:
- master
- Children:
- 0a58b3f
- Parents:
- f924e4b
- git-author:
- Tomasz Obrebski <obrebski@…> (03/30/14 23:59:06)
- git-committer:
- Tomasz Obrebski <obrebski@…> (03/30/14 23:59:06)
- Location:
- src/dgp
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/dgp/boubble.hh
r3b02b04 r519eaf5 24 24 { 25 25 public: 26 Boubble(list<Role> u, list<Role> d, LongRel l, int s=-1); 27 Boubble(const char* pathstr, const char* l, int s=-1); 28 // Boubble(const Boubble& b) {_src=b._src; _upath=b._upath; _dpath=b._dpath; _rel=b._rel; }; 29 30 Dir dir(); 31 LongRel rel(); 32 int src(); 26 Boubble() {}; 27 Boubble(list<Role> u, list<Role> d, LongRel l, int s=-1, bool r=false); 28 Boubble(const char* pathstr, const char* l, int s=-1, bool r=false); 29 //Boubble(const Boubble& b) {_src=b._src; _upath=b._upath; _dpath=b._dpath; _rel=b._rel; _reverse=b._reverse; }; 30 31 Dir dir() const; 32 LongRel rel() const; 33 int src() const; 33 34 void src(int s); 35 bool reverse() const; 36 void reverse(bool b); 34 37 35 38 Role next(); 36 39 37 40 Boubble* step(Role r, Dir d); 38 39 bool is_at_target(); 41 Boubble* reversed(); 42 43 bool is_at_target() const; 40 44 41 45 bool operator==(Boubble const& b) const; … … 52 56 list<Role> _dpath; 53 57 LongRel _rel; 58 bool _reverse; 54 59 55 60 }; … … 58 63 59 64 inline 60 Boubble::Boubble(list<Role> u, list<Role> d, LongRel l, int s) : _upath(u), _dpath(d), _rel(l), _src(s) {} 61 62 //---------------------------------------------------------------------------------------------------- 63 64 inline 65 Boubble::Boubble(const char* pathstr, const char* l, int s) 65 Boubble::Boubble(list<Role> u, list<Role> d, LongRel l, int s, bool r) 66 : _upath(u), _dpath(d), _rel(l), _src(s), _reverse(r) {} 67 68 //---------------------------------------------------------------------------------------------------- 69 70 inline 71 Boubble::Boubble(const char* pathstr, const char* l, int s, bool r) 66 72 { 67 73 Dir dir = UP; … … 83 89 _rel = LongRel(l); 84 90 _src = s; 85 } 86 87 //---------------------------------------------------------------------------------------------------- 88 89 inline 90 Dir Boubble::dir() 91 _reverse = r; 92 } 93 94 //---------------------------------------------------------------------------------------------------- 95 96 inline 97 Dir Boubble::dir() const 91 98 { 92 99 if(!_upath.empty()) … … 100 107 101 108 inline 102 LongRel Boubble::rel() 109 LongRel Boubble::rel() const 103 110 { return _rel; } 104 111 … … 106 113 107 114 inline 108 int Boubble::src() 115 int Boubble::src() const 109 116 { return _src; } 110 117 … … 114 121 void Boubble::src(int s) 115 122 { _src=s; } 123 124 //---------------------------------------------------------------------------------------------------- 125 126 inline 127 bool Boubble::reverse() const 128 { return _reverse; } 129 130 //---------------------------------------------------------------------------------------------------- 131 132 inline 133 void Boubble::reverse(bool b) 134 { _reverse=b; } 116 135 117 136 //---------------------------------------------------------------------------------------------------- … … 134 153 if(d==UP && !_upath.empty() && _upath.front() == r) 135 154 { 136 Boubble* newboubble = new Boubble(_upath,_dpath,_rel,_src );155 Boubble* newboubble = new Boubble(_upath,_dpath,_rel,_src,_reverse); 137 156 newboubble->_upath.pop_front(); 138 157 return newboubble; … … 141 160 if(d==DOWN && _upath.empty() && !_dpath.empty() && _dpath.front() == r) 142 161 { 143 Boubble* newboubble = new Boubble(_upath,_dpath,_rel,_src );162 Boubble* newboubble = new Boubble(_upath,_dpath,_rel,_src,_reverse); 144 163 newboubble->_dpath.pop_front(); 145 164 return newboubble; … … 151 170 152 171 inline 153 bool Boubble::is_at_target() 172 Boubble* Boubble::reversed() 173 { 174 Boubble* newboubble = new Boubble(_dpath,_upath,_rel,-1,!_reverse); 175 newboubble->_upath.reverse(); 176 newboubble->_dpath.reverse(); 177 // cout << *this << "-----" << *newboubble << endl; 178 return newboubble; 179 } 180 181 //---------------------------------------------------------------------------------------------------- 182 183 inline 184 bool Boubble::is_at_target() const 154 185 { return _upath.empty() && _dpath.empty(); } 155 186 … … 208 239 o << b._rel.str(); 209 240 o << "]"; 241 if(b.reverse()) o << "!"; 242 return o; 210 243 } 211 244 -
src/dgp/dgp1.cc
rb97a556 r519eaf5 1 #include <iostream> 2 using namespace std; 3 1 4 #include "dgp0.hh" 2 5 #include "global.hh" … … 79 82 { 80 83 ret = *ps; 81 // fprintf(stderr,"FIND EXISTING NODE SUCCEEDED BEACAUSE OFLH/LV equality ()\n");84 fprintf(stderr,"#\tsucceeded because of LH/LV equality ()\n"); 82 85 } 83 86 else 84 87 { 85 // fprintf(stderr,"FIND EXISTING NODE FAILED BEACAUSE OFLH/LV inequality\n");88 fprintf(stderr,"#\tfailed beacause of LH/LV inequality\n"); 86 89 } 87 90 } … … 158 161 //==================================================================================================== 159 162 160 int create_new_head_node_left(int h, NodeProp& newheadprop, bitset<MAXNODES>& newheadLH, bitset<MAXNODES>& newheadLD, bitset<MAXNODES>& newheadLV) 161 { 162 int newheadind = sgraph.clone(h,newheadprop); 163 // list<int>::iterator nextit=h; ++nextit; 164 // nodelist.insert(nextit,newheadind); 163 int create_new_head_node_left(int anc, NodeProp& prop, bitset<MAXNODES>& LH, bitset<MAXNODES>& LD, bitset<MAXNODES>& LV) 164 { 165 int newheadind = sgraph.clone(anc,prop); 165 166 nodelist.push_back(newheadind); 166 sgraph[newheadind].LH =newheadLH;167 sgraph[newheadind].LD = newheadLD;168 sgraph[newheadind].in_LH =true;167 sgraph[newheadind].LH = LH; 168 sgraph[newheadind].LD = LD; 169 sgraph[newheadind].in_LH = true; 169 170 sgraph[newheadind].LV.reset(); 170 171 171 copy_links( h,newheadind);172 copy_links(anc,newheadind); 172 173 create_reverse_links(newheadind); 173 174 174 if(debug) sgraph.print_node_debug(stderr," C ",newheadind,h);175 if(debug) sgraph.print_node_debug(stderr,"add new",newheadind,anc); 175 176 // if(debug) print_sets(newheadind); 176 177 return newheadind; 177 178 } 178 179 179 int create_new_dep_node_left(int d, NodeProp& prop, bitset<MAXNODES>& LH, bitset<MAXNODES>& LD, bitset<MAXNODES>& LV) 180 { 181 int newind = sgraph.clone(d,prop); 182 // list<int>::iterator nextit=d; ++nextit; 183 // nodelist.insert(nextit,newind); 180 int create_new_dep_node_left(int anc, NodeProp& prop, bitset<MAXNODES>& LH, bitset<MAXNODES>& LD, bitset<MAXNODES>& LV) 181 { 182 int newind = sgraph.clone(anc,prop); 184 183 nodelist.push_back(newind); 185 184 sgraph[newind].LH.reset(); … … 188 187 sgraph[newind].LV.reset(); 189 188 190 copy_links( d,newind);189 copy_links(anc,newind); 191 190 create_reverse_links(newind); 192 191 193 if(debug) sgraph.print_node_debug(stderr," C ",newind,d);192 if(debug) sgraph.print_node_debug(stderr,"add new",newind,anc); 194 193 // if(debug) print_sets(newind); 195 194 … … 197 196 } 198 197 199 int create_new_head_node_right(int h, NodeProp& newheadprop, bitset<MAXNODES>& newheadLH, bitset<MAXNODES>& newheadLD, bitset<MAXNODES>& newheadLV) 200 { 201 int newheadind = sgraph.clone(h,newheadprop); 202 // list<int>::iterator nextit=h; ++nextit; 203 // nodelist.insert(nextit,newheadind); 198 int create_new_head_node_right(int anc, NodeProp& prop, bitset<MAXNODES>& newheadLH, bitset<MAXNODES>& newheadLD, bitset<MAXNODES>& newheadLV) 199 { 200 int newheadind = sgraph.clone(anc,prop); 204 201 nodelist.push_back(newheadind); 205 202 sgraph[newheadind].LH=newheadLH; … … 208 205 sgraph[newheadind].LV=newheadLV; 209 206 210 copy_links( h,newheadind);207 copy_links(anc,newheadind); 211 208 create_reverse_links(newheadind); 212 209 213 if(debug) sgraph.print_node_debug(stderr," C ",newheadind,h);210 if(debug) sgraph.print_node_debug(stderr,"add new",newheadind,anc); 214 211 // if(debug) print_sets(newheadind); 215 212 … … 217 214 } 218 215 219 int create_new_dep_node_right(int d, NodeProp& prop, bitset<MAXNODES>& LH, bitset<MAXNODES>& LD, bitset<MAXNODES>& LV)220 { 221 int newind = sgraph.clone( d,prop);216 int create_new_dep_node_right(int anc, NodeProp& prop, bitset<MAXNODES>& LH, bitset<MAXNODES>& LD, bitset<MAXNODES>& LV) 217 { 218 int newind = sgraph.clone(anc,prop); 222 219 nodelist.push_back(newind); 223 220 sgraph[newind].LH=LH; … … 226 223 sgraph[newind].LV.reset(); 227 224 228 copy_links( d,newind);225 copy_links(anc,newind); 229 226 create_reverse_links(newind); 230 227 231 if(debug) sgraph.print_node_debug(stderr," C ",newind,d);228 if(debug) sgraph.print_node_debug(stderr,"ADD NEW",newind,anc); 232 229 // if(debug) print_sets(newind); 233 230 … … 253 250 bitset<MAXNODES> newheadLV = sgraph[d].LV; 254 251 bitset<MAXNODES> newheadLD = sgraph[h].LD; 255 256 // vector<int> newedge;257 252 258 253 newheadind = find_existing_node(sgraph[h].mnode, newheadprop, newheadLH, newheadLV); … … 302 297 if(sgraph[d].saturated()) sgraph[newheadind].LD |= sgraph[d].LD; 303 298 304 if(debug) sgraph.print_arc(stderr, newheadind,d,l.role,0);305 if(debug) sgraph.print_node_debug(stderr," U",newheadind,h);299 if(debug) sgraph.print_arc(stderr,"new link",newheadind,d,l.role,0); 300 if(debug) sgraph.print_node_debug(stderr,"update",newheadind,h); 306 301 // if(debug) print_sets(newheadind); 307 if(debug) sgraph.print_node_debug(stderr," U",newdepind,d);302 if(debug) sgraph.print_node_debug(stderr,"update",newdepind,d); 308 303 // if(debug) print_sets(newdepind); 309 304 } … … 380 375 if(sgraph[newheadind].saturated()) sgraph[newdepind].LH |= sgraph[newheadind].LH; 381 376 382 if(debug) sgraph.print_arc(stderr,newheadind,newdepind,l.role,1); 383 if(debug) sgraph.print_node_debug(stderr,"U ",newheadind,h); 384 if(debug) sgraph.print_node_debug(stderr,"U ",newdepind,d); 385 377 if(debug) sgraph.print_arc(stderr,"new link",newheadind,newdepind,l.role,1); 378 if(debug) sgraph.print_node_debug(stderr,"update",newheadind,h); 379 if(debug) sgraph.print_node_debug(stderr,"update",newdepind,d); 380 381 } 382 383 //==================================================================================================== 384 385 // bool check_meeting_boubles(list<Boubble*>& hboubbles, list<Boubble*>& dboubbles) 386 // { 387 // bool hremove=false; // czy usun±æ ostatnio sprawdzany b±bel 388 // bool dremove=false; // czy usun±æ ostatnio sprawdzany b±bel 389 390 // for(list<Boubble*>::iterator hb = hboubbles.begin(); hb != hboubbles.end(); hb = hremove ? hboubbles.erase(hb) : ++hb ) 391 // { 392 // hremove=false; 393 // for(list<Boubble*>::iterator db = dboubbles.begin(); db != dboubbles.end(); db = dremove ? dboubbles.erase(db) : ++db ) 394 // { 395 // dremove=false; 396 // if( (*hb)->rel()==(*db)->rel() && (*hb)->dir()==DOWN && (*db)->dir()==UP && (*hb)->reverse()!=(*db)->reverse() ) 397 // { 398 // int srcnode,dstnode; 399 // if( (*hb)->reverse()==false ) 400 // srcnode = (*hb)->src(), dstnode = (*db)->src(); 401 // else 402 // srcnode = (*db)->src(), dstnode = (*hb)->src(); 403 // if( grammar.check_longrel(sgraph.cat(srcnode), sgraph.cat(dstnode), (*hb)->rel()) ) 404 // { 405 // hremove=dremove=true; 406 // if(debug) fprintf(stderr,"BOUBBLES MET!!!\n"); 407 // } 408 // else 409 // { 410 // if(debug) fprintf(stderr,"BOUBBLES' MEETING FAILED!!!\n"); 411 // return false; 412 // } 413 // } 414 // } 415 // } 416 // return true; 417 // } 418 419 //==================================================================================================== 420 421 bool check_meeting_boubles(list<Boubble*>& boubbles) 422 { 423 bool hremove=false; // czy usun±æ ostatnio sprawdzany b±bel 424 bool dremove=false; // czy usun±æ ostatnio sprawdzany b±bel 425 426 for(list<Boubble*>::iterator hb = boubbles.begin(); hb != boubbles.end(); hb = hremove ? boubbles.erase(hb) : ++hb ) 427 { 428 cout << endl << "hb:" << **hb ; 429 hremove=false; 430 for(list<Boubble*>::iterator db = hb; db != boubbles.end(); db = dremove ? boubbles.erase(db) : ++db ) 431 { 432 cout << " db:" << **db; 433 dremove=false; 434 if( (*hb)->rel()==(*db)->rel() && (*hb)->reverse()!=(*db)->reverse() ) 435 { 436 cout << "Z"; 437 int srcnode,dstnode; 438 if( (*hb)->reverse()==false ) 439 srcnode = (*hb)->src(), dstnode = (*db)->src(); 440 else 441 srcnode = (*db)->src(), dstnode = (*hb)->src(); 442 if( grammar.check_longrel(sgraph.cat(srcnode), sgraph.cat(dstnode), (*hb)->rel()) ) 443 { 444 cout << " REMOVE "; 445 hremove=dremove=true; 446 if(debug) fprintf(stderr,"BOUBBLES MET!!!\n"); 447 } 448 else 449 { 450 cout << " FAIL "; 451 if(debug) fprintf(stderr,"BOUBBLES' MEETING FAILED!!!\n"); 452 return false; 453 } 454 } 455 } 456 } 457 return true; 386 458 } 387 459 … … 393 465 bool check_boubbles_at_target(list<Boubble*>& boubbles, int node) 394 466 { 395 list<Boubble*>::iterator last; // ostatnio sprawdzany b±bel396 467 bool remove=false; // czy usun±æ ostatnio sprawdzany b±bel 397 468 … … 399 470 if( (*b)->is_at_target() ) 400 471 if( grammar.check_longrel(sgraph.cat((*b)->src()), sgraph.cat(node), (*b)->rel()) ) 401 remove=true; 472 { 473 cout << endl << "REMOVE ChBatT " << **b << endl; 474 remove=true; 475 } 402 476 else 403 477 return false; … … 412 486 void try_connect_dependents(int j) 413 487 { 414 // for(list<int>::iterator i(j); i!=nodelist.begin(); --i)415 // if(sgraph.visible(*i,*j) && sgraph.saturated(*i))416 488 LViterator lvi(sgraph,j); 417 489 int i; 418 490 while((i=lvi.next()) >= 0) 419 if(sgraph.saturated(i)) 420 { 421 if(debug) {fprintf(stderr,"## %d <-- %d ... ",i,j); } 422 423 list<const Link*> ji_links = grammar.connectable2( sgraph.cat(j), sgraph.cat(i), sgraph[j].prop.flags, sgraph[i].prop.flags); // ref do Roles!!! 424 list<const Link*>::iterator ri = ji_links.begin(); 425 if(ri == ji_links.end()) { if(debug) fprintf(stderr,"no roles\n"); } 491 { 492 //if(debug) sgraph.print_node_debug(stderr,"D-CUR>",i,-1); 493 494 if(sgraph.saturated(i)) 495 { 496 if(debug) {fprintf(stderr,"%d <--",i); } 497 498 list<const Link*> ji_links = grammar.connectable2( sgraph.cat(j), sgraph.cat(i), sgraph[j].prop.flags, sgraph[i].prop.flags); // ref do Roles!!! 499 list<const Link*>::iterator ri = ji_links.begin(); 500 if(ri == ji_links.end()) { if(debug) fprintf(stderr," no roles\n"); } 501 else 502 { 503 for(; ri != ji_links.end(); ++ri ) 504 { 505 if(debug) fprintf(stderr," %s",(*ri)->role.str()); 506 if(!grammar.check_constr2(sgraph[j].prop,sgraph[i].prop,0,**ri )) 507 { if(debug) fprintf(stderr," ...constraints failed\n"); } 508 else 509 { 510 list<Boubble*> new_head_boubbles = collect_head_boubbles(j,i,(*ri)->role); 511 list<Boubble*> new_dep_boubbles = collect_dep_boubbles(j,i,(*ri)->role); 512 if( check_meeting_boubles(new_head_boubbles) && 513 check_meeting_boubles(new_dep_boubbles) && 514 check_boubbles_at_target(new_head_boubbles,j) && 515 check_boubbles_at_target(new_dep_boubbles,i) ) 516 { 517 if(debug) fprintf(stderr," ...SUCCESS!\n"); 518 connect_left( j, i, **ri, new_head_boubbles, new_dep_boubbles); 519 } 520 else 521 { if(debug) fprintf(stderr," ...boubbles failed\n"); } 522 } 523 } 524 } 525 } 426 526 else 427 { 428 for(; ri != ji_links.end(); ++ri ) 429 if(!grammar.check_constr2(sgraph[j].prop,sgraph[i].prop,0,**ri )) 430 { if(debug) fprintf(stderr,"constraints failed\n"); } 431 else 432 { 433 list<Boubble*> new_head_boubbles = collect_head_boubbles(j,i,(*ri)->role); 434 list<Boubble*> new_dep_boubbles = collect_dep_boubbles(j,i,(*ri)->role); 435 436 if( !(check_boubbles_at_target(new_head_boubbles,j) && check_boubbles_at_target(new_dep_boubbles,i)) ) 437 { if(debug) fprintf(stderr,"boubbles failed\n"); } 438 else 439 { 440 if(debug) fprintf(stderr,"success\n"); 441 connect_left( j, i, **ri, new_head_boubbles, new_dep_boubbles); 442 } 443 } 444 } 445 } 446 } 447 448 527 if(debug) {fprintf(stderr,"%d <-- unsaturated\n",i); } 528 } 529 530 } 449 531 //---------------------------------------------------------------------------------------------------- 450 532 451 533 void try_connect_heads(int j) 452 534 { 453 // for(list<int>::iterator i(j); i!=nodelist.begin(); --i)454 // if(sgraph.visible(*i,*j) && sgraph.saturated(*j))455 456 535 LViterator lvi(sgraph,j); 457 536 int i; 458 537 while((i=lvi.next()) >= 0) 459 if(sgraph.saturated(j)) 460 { 461 if(debug) fprintf(stderr, "## %d --> %d ... ",i,j); 462 463 list<const Link*> ij_links = grammar.connectable2( sgraph.cat(i), sgraph.cat(j), sgraph[i].prop.flags, sgraph[j].prop.flags ); 464 list<const Link*>::iterator ri = ij_links.begin(); 465 if(ri == ij_links.end()) { if(debug) fprintf(stderr,"no roles\n"); } 538 { 539 // if(debug) sgraph.print_node_debug(stderr,"H-CUR> ",i,-1); 540 if(sgraph.saturated(j)) 541 { 542 if(debug) fprintf(stderr, "%d -->",i); 543 544 list<const Link*> ij_links = grammar.connectable2( sgraph.cat(i), sgraph.cat(j), sgraph[i].prop.flags, sgraph[j].prop.flags ); 545 list<const Link*>::iterator ri = ij_links.begin(); 546 if(ri == ij_links.end()) { if(debug) fprintf(stderr," no roles\n"); } 547 else 548 { 549 for(; ri != ij_links.end(); ++ri ) 550 { 551 if(debug) fprintf(stderr," %s",(*ri)->role.str()); 552 if( !grammar.check_constr2( sgraph[i].prop, sgraph[j].prop, 1, **ri ) ) 553 { if(debug) fprintf(stderr," ...constraints failed\n"); } 554 else 555 { 556 list<Boubble*> new_head_boubbles = collect_head_boubbles(i,j,(*ri)->role); 557 list<Boubble*> new_dep_boubbles = collect_dep_boubbles(i,j,(*ri)->role); 558 559 if( check_meeting_boubles(new_head_boubbles) && 560 check_meeting_boubles(new_dep_boubbles) && 561 check_boubbles_at_target(new_head_boubbles,i) && 562 check_boubbles_at_target(new_dep_boubbles,j) ) 563 { 564 if(debug) fprintf(stderr," ...SUCCESS!\n"); 565 connect_right( i, j, **ri, new_head_boubbles, new_dep_boubbles ); 566 } 567 else 568 { if(debug) fprintf(stderr," ...bubbles failed\n",i); } 569 } 570 } 571 } 572 } 466 573 else 467 { 468 for(; ri != ij_links.end(); ++ri ) 469 if( !grammar.check_constr2( sgraph[i].prop, sgraph[j].prop, 1, **ri ) ) 470 { if(debug) fprintf(stderr,"constraints failed\n"); } 471 else 472 { 473 list<Boubble*> new_head_boubbles = collect_head_boubbles(i,j,(*ri)->role); 474 list<Boubble*> new_dep_boubbles = collect_dep_boubbles(i,j,(*ri)->role); 475 476 if( !(check_boubbles_at_target(new_head_boubbles,i) && check_boubbles_at_target(new_dep_boubbles,j)) ) 477 { if(debug) fprintf(stderr,"boubbles failed\n"); } 478 else 479 { 480 if(debug) fprintf(stderr,"success\n"); 481 connect_right( i, j, **ri, new_head_boubbles, new_dep_boubbles ); 482 } 483 } 484 } 574 if(debug) {fprintf(stderr,"%d <-- unsaturated\n",j); } 485 575 } 486 576 } … … 571 661 nodelist.push_back(basenode); 572 662 573 if(debug) sgraph.print_node_debug(stderr," B",basenode,-1); // STDOUT!!!574 if(debug) print_sets(basenode);663 if(debug) sgraph.print_node_debug(stderr,"add base",basenode,-1); // STDOUT!!! 664 // if(debug) print_sets(basenode); 575 665 576 666 list<int>::iterator cursor=processed; 577 667 while(++cursor != nodelist.end()) 578 668 { 579 if(debug) sgraph.print_node_debug(stderr," > ",*cursor,-1);669 if(debug) sgraph.print_node_debug(stderr,"MAIN-CUR> ",*cursor,-1); 580 670 try_connect_dependents(*cursor); 581 671 try_connect_heads(*cursor); -
src/dgp/grammar.hh
ra15e59b r519eaf5 118 118 vector< vector< LongRels > > longrel; //[Cat][Cat] 119 119 120 list< Boubble* > 120 list< Boubble* > boubbles; 121 121 122 122 vector< vector< list<Boubble*> > > uptrigger;//[Cat][Role] … … 126 126 void add_type(const char* s); 127 127 void add_flag(const char* s) { Flag::add(s); } 128 void add_long(const char* l, const char* p) { LongRel::add(l); boubbles.push_back( new Boubble(p,l) ); } 128 void add_long(const char* l, const char* p) { LongRel::add(l); boubbles.push_back( new Boubble(p,l) ); 129 boubbles.push_back( (new Boubble(p,l))->reversed() ); } 129 130 void add_triggers(Cat h, Cat d, LongRel l); 130 131 -
src/dgp/sgraph.cc
rb97a556 r519eaf5 29 29 30 30 newnode.edge.push_back(lastnodeind()); 31 32 newnode.edge_contains_self = true ; 31 33 32 34 return lastnodeind(); … … 85 87 //---------------------------------------------------------------------------------------------------- 86 88 87 void SGraph::print_arc(FILE* f, int head, int dep, Role role, int dir) // 0 - left, 1 - right89 void SGraph::print_arc(FILE* f, const char* msg, int head, int dep, Role role, int dir) // 0 - left, 1 - right 88 90 { 89 91 if(dir==0) 90 fprintf(f," #A %s:%d <-- %d\n", role.str(), dep, head);92 fprintf(f,"%s %s:%d <-- %d\n", msg, role.str(), dep, head); 91 93 else 92 fprintf(f," #A %s:%d --> %d\n", role.str(), head, dep);94 fprintf(f,"%s %s:%d --> %d\n", msg, role.str(), head, dep); 93 95 } 94 96 … … 113 115 for(vector<Arc>::iterator h=node.heads.begin(); h!=node.heads.end(); ++h) 114 116 { 115 // if(cont) buf+=sprintf(buf,","); else cont=true;116 117 buf+=sprintf(buf,"(++%s:%d)",h->role.str(),h->dst); 117 // buf+=sprintf(buf,"++%s-%d(%d~%d)",h->role.str(),h->dst,h->headanc,h->depanc);118 // buf+=sprintf(buf,"(<-%s-%d)",h->role.str(),h->dst);119 118 } 120 119 … … 122 121 for(vector<Arc>::iterator d=node.deps.begin(); d!=node.deps.end(); ++d) 123 122 { 124 // if(! nodes[d->dst].saturated()) continue; // NIE DRUKUJ NIENASYCONYCH PODRZEDNIKOW125 // if(cont) buf+=sprintf(buf,","); else cont=true;126 123 buf+=sprintf(buf,"(--%s:%d)",d->role.str(),d->dst); 127 // buf+=sprintf(buf,"--%s-%d(%d~%d)",d->role.str(),d->dst,d->headanc,d->depanc);128 // buf+=sprintf(buf,"(-%s->%d)",d->role.str(),d->dst);129 124 } 130 125 … … 177 172 { 178 173 char *buf0 = buf; 179 buf+=sprintf(buf,"#%s",pref); 180 181 buf+=sprintf(buf,"%-16s",form(n)); 182 174 buf+=sprintf(buf,"%-10s",pref); 175 buf+=sprintf(buf,"%d.%s",n,form(n)); 176 buf+=sprintf(buf,";"); 177 buf+=sprintf(buf,"%s ",cat(n).str()); 178 while(buf-buf0<40) buf+=sprintf(buf," "); 183 179 buf+=sprint_node(buf,n,anc,HEADS|DEPS|SETS|CONSTRAINTS); 184 180 185 buf+=sprintf(buf,"/");186 for(vector<int>::iterator e = nodes[n].edge.begin(); e != nodes[n].edge.end(); e++ )187 buf += sprintf(buf,"%d ", *e);181 // buf+=sprintf(buf,"/"); 182 // for(vector<int>::iterator e = nodes[n].edge.begin(); e != nodes[n].edge.end(); e++ ) 183 // buf += sprintf(buf,"%d ", *e); 188 184 189 185 buf+=sprintf(buf,"\n"); -
src/dgp/sgraph.hh
r3b02b04 r519eaf5 228 228 int print_node_debug(FILE* f, const char* pref, int n, int anc); 229 229 230 void print_arc(FILE* f, int left, int right, Role role, int dir); // 0 - left, 1 - right230 void print_arc(FILE* f, const char* msg, int left, int right, Role role, int dir); // 0 - left, 1 - right 231 231 232 232 //private: … … 327 327 328 328 } 329 // if(!strict)330 // {331 // push_ld(n);332 // push_ln(n);333 // }334 329 } 335 330
Note: See TracChangeset
for help on using the changeset viewer.