Changeset d484a32
- Timestamp:
- 10/24/14 13:07:15 (10 years ago)
- Branches:
- master
- Children:
- acbabee
- Parents:
- 56c300b
- git-author:
- Tomasz Obrebski <obrebski@…> (10/24/14 13:07:15)
- git-committer:
- Tomasz Obrebski <obrebski@…> (10/24/14 13:07:15)
- Location:
- src/dgp
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/dgp/Makefile
re7de6cc rd484a32 11 11 #vpath %.o . 12 12 13 CXXFLAGS = -g - static13 CXXFLAGS = -g -Wno-deprecated -static 14 14 15 15 sources = main.cc grammar.cc symbol.cc mgraph.cc sgraph.cc dgp1.cc cmdline.cc \ … … 47 47 rm -f ${bin} ${objs} cmdline.* 48 48 rm -f *.d 49 rm -f *~ 49 50 50 51 .PHONY: prof -
src/dgp/dgp1.cc
r519eaf5 rd484a32 82 82 { 83 83 ret = *ps; 84 fprintf(stderr,"#\tsucceeded because of LH/LV equality ()\n");84 if(debug) fprintf(stderr,"#\tsucceeded because of LH/LV equality ()\n"); 85 85 } 86 86 else 87 87 { 88 fprintf(stderr,"#\tfailed beacause of LH/LV inequality\n");88 if(debug) fprintf(stderr,"#\tfailed beacause of LH/LV inequality\n"); 89 89 } 90 90 } … … 517 517 if(debug) fprintf(stderr," ...SUCCESS!\n"); 518 518 connect_left( j, i, **ri, new_head_boubbles, new_dep_boubbles); 519 lvi.update_edge(sgraph,i); 519 520 } 520 521 else -
src/dgp/grammar.cc
r3b02b04 rd484a32 31 31 Cat::add(s); 32 32 33 if(connect.size() <= Cat::count())34 {35 connect.resize(Cat::count()+RESIZE_DELTA);36 for(int i=0; i<connect.size(); ++i)37 if(connect[i].size() <= Cat::count()) connect[i].resize(Cat::count()+RESIZE_DELTA);38 }33 // if(connect.size() <= Cat::count()) 34 // { 35 // connect.resize(Cat::count()+RESIZE_DELTA); 36 // for(int i=0; i<connect.size(); ++i) 37 // if(connect[i].size() <= Cat::count()) connect[i].resize(Cat::count()+RESIZE_DELTA); 38 // } 39 39 if(connect1.size() <= Cat::count()) 40 40 { … … 331 331 332 332 if( chk_cat(cat1) && chk_cat(cat2) && chk_type(type) ) 333 set_connect(cat1,parse_flags(flags1,"+"),parse_flags(flags1,"-"),cat2,parse_flags(flags2,"+"),parse_flags(flags2,"-"),type,parse_props(props) );333 set_connect(cat1,parse_flags(flags1,"+"),parse_flags(flags1,"-"),cat2,parse_flags(flags2,"+"),parse_flags(flags2,"-"),type,parse_props(props),lineno); 334 334 else if( chk_cat(cat1) && chk_cat(cat2) && chk_long(type) ) 335 335 { … … 504 504 if(obl[c].test(r)) fprintf(f,"REQ\t%s\t%s\n",c.str(),r.str()); 505 505 506 for(Cat c=1; c<Cat::count(); ++c)507 for(Cat d=1; d<Cat::count(); ++d)508 for(Role t=1; t<Role::count(); ++t)509 if(connect[c][d].count(t))510 fprintf(f,"LINK\t%s\t%s\t%s\n",c.str(),d.str(),t.str());506 // for(Cat c=1; c<Cat::count(); ++c) 507 // for(Cat d=1; d<Cat::count(); ++d) 508 // for(Role t=1; t<Role::count(); ++t) 509 // if(connect[c][d].count(t)) 510 // fprintf(f,"LINK\t%s\t%s\t%s\n",c.str(),d.str(),t.str()); 511 511 512 512 for(LongRel i=1; i<LongRel::count(); ++i) -
src/dgp/grammar.hh
r519eaf5 rd484a32 27 27 struct Link 28 28 { 29 Link(Role r, Flag dfplus="NULL", Flag dfminus="NULL") : role(r), dflagplus(dfplus), dflagminus(dfminus) { }30 Link(Role r, PropSet ps=EmptyPropSet, Flag hfp="NULL", Flag hfm="NULL", Flag dfp="NULL", Flag dfm="NULL" )29 // Link(Role r, Flag dfplus="NULL", Flag dfminus="NULL") : role(r), dflagplus(dfplus), dflagminus(dfminus) { } 30 Link(Role r, PropSet ps=EmptyPropSet, Flag hfp="NULL", Flag hfm="NULL", Flag dfp="NULL", Flag dfm="NULL", int lineno=0) 31 31 : role(r), props(ps), hflagplus(hfp), hflagminus(hfm), dflagplus(dfp), dflagminus(dfm) { } 32 32 //Link(Role r) : role(r), dflagplus("NULL") { } … … 38 38 Flag dflagminus; 39 39 PropSet props; 40 int lineno; 40 41 41 42 bool operator<(const Link& l) const … … 67 68 Grammar() {} ; 68 69 69 Roles& connectable(Cat h, Cat d);70 Roles connectable(Cat h, Cat d, FlagSet f, FlagSet df);71 72 70 list<const Link*> connectable2(Cat h, Cat d, FlagSet hfs, FlagSet dfs); 73 71 … … 109 107 vector< FlagSet > pass; //[Role] 110 108 111 vector< vector< Roles > > connect; //[Cat][Cat]109 // vector< vector< Roles > > connect; //[Cat][Cat] 112 110 113 111 vector< vector< Links > > connect1; //[Cat][Cat] … … 143 141 // void set_connect(Cat c, Cat d, Flag f, Role r) { connect1[c][d].insert(Link(r,f)); } 144 142 145 void set_connect(Cat h, Flag hfp, Flag hfm, Cat d, Flag dfp, Flag dfm, Role r, PropSet ps ) { connect1[h][d].insert(Link(r,ps,hfp,hfm,dfp,dfm)); }143 void set_connect(Cat h, Flag hfp, Flag hfm, Cat d, Flag dfp, Flag dfm, Role r, PropSet ps, int lineno ) { connect1[h][d].insert(Link(r,ps,hfp,hfm,dfp,dfm,lineno)); } 146 144 147 145 void set_include(Role r, Role s) { include[r].set(s); } … … 160 158 161 159 inline 162 Roles& Grammar::connectable(Cat h, Cat d)163 {164 return connect[h][d];165 }166 167 //----------------------------------------------------------------------------------------------------168 169 inline170 Roles Grammar::connectable(Cat h, Cat d, FlagSet hfs, FlagSet dfs) // ZBYT WOLNE!!!!!!!!!!!!!!!!!!!!!!!!!! (-> Roles&)171 {172 Roles ret;173 for(Links::const_iterator l = connect1[h][d].begin(); l != connect1[h][d].end(); l++)174 if( (l->hflagplus==0 || hfs[l->hflagplus]) && (l->hflagminus==0 || !hfs[l->hflagminus]) )175 if( (l->dflagplus==0 || dfs[l->dflagplus]) && (l->dflagminus==0 || !dfs[l->dflagminus]) )176 ret.insert(l->role);177 return ret;178 }179 180 //----------------------------------------------------------------------------------------------------181 182 inline183 160 list<const Link*> Grammar::connectable2(Cat h, Cat d, FlagSet hfs, FlagSet dfs) // ZBYT WOLNE!!!!!!!!!!!!!!!!!!!!!!!!!! (-> Roles&) 184 161 { … … 190 167 return ret; 191 168 } 192 193 //----------------------------------------------------------------------------------------------------194 195 // inline196 // bool Grammar::check_constr(NodeProp& hprop, NodeProp& dprop, int dir, Role role) // dir: 0-left 1-right197 // {198 // return199 // !hprop.forbidden[role] &&200 // ( dir==1 || !right[role] ) &&201 // ( dir==0 || !left[role] ) &&202 // ( dir==1 || (hprop.attached&init).none() ) &&203 // ( dir==0 || (hprop.attached&fin).none() )204 // ;205 // }206 169 207 170 //---------------------------------------------------------------------------------------------------- -
src/dgp/sgraph.cc
r519eaf5 rd484a32 179 179 buf+=sprint_node(buf,n,anc,HEADS|DEPS|SETS|CONSTRAINTS); 180 180 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);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); 184 184 185 185 buf+=sprintf(buf,"\n"); -
src/dgp/sgraph.hh
r519eaf5 rd484a32 296 296 LViterator(SGraph& sg, int n, bool s); 297 297 int next(); 298 void update_edge(SGraph& sg, int e); 298 299 299 300 private: … … 308 309 void push_lh(int i); 309 310 void push_ln(int i); 311 310 312 }; 311 313 … … 326 328 } 327 329 330 } 331 } 332 333 inline void LViterator::update_edge(SGraph& sg, int n) 334 { 335 for(vector<int>::iterator i=sg[n].edge.begin(); i!=sg[n].edge.end(); ++i) 336 { 337 push_ld(*i); 338 push_ln(*i); 328 339 } 329 340 } -
src/dgp/thesymbols.hh
re7de6cc rd484a32 18 18 typedef list<Role>::iterator RoleListIter; 19 19 typedef bitset<MAXTYPES> RoleSet; 20 typedef set<Role> Roles;21 typedef Roles::iterator RolesIter;20 // typedef set<Role> Roles; 21 // typedef Roles::iterator RolesIter; 22 22 23 23 typedef Symbol<3> Constr;
Note: See TracChangeset
for help on using the changeset viewer.