- Timestamp:
- 03/13/12 17:07:34 (13 years ago)
- Branches:
- master
- Children:
- f4bf33e
- Parents:
- abd28d1
- git-author:
- Tomasz Obrebski <to@…> (03/13/12 17:07:34)
- git-committer:
- Tomasz Obrebski <to@…> (03/13/12 17:07:34)
- Location:
- src/dgp
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/dgp/cmdline_dgp.ggo
r5f4d9c3 ra15e59b 11 11 flag off 12 12 13 option "time" - "Print parse time." 14 flag off 15 13 16 option "info" - "Print info. 14 h - heads d - dependents 15 s - sets 16 c - constraints n - node/arc counts t - parse time 17 " 17 h - heads d - dependents 18 s - sets 19 c - constraints n - node/arc counts" 18 20 string no default="h" -
src/dgp/dgp1.cc
re7de6cc ra15e59b 303 303 //==================================================================================================== 304 304 305 bool check_boubbles_at_target(list<Boubble*> boubbles, int node) 306 { 307 for(list<Boubble*>::iterator b = boubbles.begin(); b != boubbles.end(); b++) 308 if( (*b)->is_at_target() && !grammar.check_longrel(sgraph.cat((*b)->src()), sgraph.cat(node), (*b)->rel())) 309 return false; 305 // sprawdza czy te, spo¶ród b±bli, które dotar³y do celu node 306 // daj± wynik prawdziwy, dodatkowo - usuwa je z listy boubbles 307 308 bool check_boubbles_at_target(list<Boubble*>& boubbles, int node) 309 { 310 list<Boubble*>::iterator last; // ostatnio sprawdzany b±bel 311 bool remove=false; // czy usun±æ ostatnio sprawdzany b±bel 312 313 for(list<Boubble*>::iterator b = boubbles.begin(); b != boubbles.end(); b = remove ? boubbles.erase(b) : ++b ) 314 if( (*b)->is_at_target() ) 315 if( grammar.check_longrel(sgraph.cat((*b)->src()), sgraph.cat(node), (*b)->rel()) ) 316 remove=true; 317 else 318 return false; 319 else 320 remove=false; 321 310 322 return true; 311 323 } 324 325 // bool check_boubbles_at_target(list<Boubble*> boubbles, int node) 326 // { 327 // for(list<Boubble*>::iterator b = boubbles.begin(); b != boubbles.end(); ++b ) 328 // if( (*b)->is_at_target() && !grammar.check_longrel(sgraph.cat((*b)->src()), sgraph.cat(node), (*b)->rel()) ) 329 // return false; 330 // return true; 331 // } 312 332 313 333 //==================================================================================================== -
src/dgp/grammar.cc
re7de6cc ra15e59b 187 187 Prop::add("INIT"); 188 188 Prop::add("FIN"); 189 Prop::add("LEFT"); 190 Prop::add("RIGHT"); 189 191 190 192 //<<< TU? -
src/dgp/grammar.hh
re7de6cc ra15e59b 192 192 //---------------------------------------------------------------------------------------------------- 193 193 194 inline195 bool Grammar::check_constr(NodeProp& hprop, NodeProp& dprop, int dir, Role role) // dir: 0-left 1-right196 {197 return198 !hprop.forbidden[role] &&199 ( dir==1 || !right[role] ) &&200 ( dir==0 || !left[role] ) &&201 ( dir==1 || (hprop.attached&init).none() ) &&202 ( dir==0 || (hprop.attached&fin).none() )203 ;204 }194 // inline 195 // bool Grammar::check_constr(NodeProp& hprop, NodeProp& dprop, int dir, Role role) // dir: 0-left 1-right 196 // { 197 // return 198 // !hprop.forbidden[role] && 199 // ( dir==1 || !right[role] ) && 200 // ( dir==0 || !left[role] ) && 201 // ( dir==1 || (hprop.attached&init).none() ) && 202 // ( dir==0 || (hprop.attached&fin).none() ) 203 // ; 204 // } 205 205 206 206 //---------------------------------------------------------------------------------------------------- … … 211 211 return 212 212 !hprop.forbidden[link.role] && 213 ( dir==1 || !right[link.role] ) &&214 ( dir==0 || !left[link.role]) &&213 ( dir==1 || (!right[link.role] && !link.props[Prop("RIGHT")]) ) && // ZREZYGNOWAÆ Z TABLICY right[<role>] 214 ( dir==0 || (!left[link.role] && !link.props[Prop("LEFT")]) ) && 215 215 ( dir!=0 || !hprop.init_attached ) && 216 216 ( dir!=1 || !hprop.fin_attached ) -
src/dgp/main.cc
re7de6cc ra15e59b 6 6 * Author: Tomasz Obrebski 7 7 */ 8 9 #include <ctime> 10 #include <sys/time.h> 8 11 9 12 #include "global.hh" … … 16 19 17 20 #define MAXSEGMENTS 500 21 22 #define MICROSECONDSELAPSED(A,B) ((B.tv_sec - A.tv_sec)*1000000 + (B.tv_usec - A.tv_usec)) 18 23 19 24 char segment[MAXSEGMENTS][MAXLINE]; … … 30 35 FILE* debugf=stdout; 31 36 unsigned int info=0U; 37 38 bool printtimeinfo=false; 32 39 33 40 void output(); … … 53 60 if(args.debug_given) debug=true; 54 61 62 if(args.time_given) printtimeinfo=true; 63 55 64 for(char* c=args.info_arg; *c!='\0' ; ++c) 56 65 switch(*c) … … 70 79 // exit(0); 71 80 72 81 struct timeval starttime,afterinput,afterparse,endtime; 73 82 74 83 mgraph.clear(); … … 78 87 while (fgets(line, MAXLINE+1, inputf)) 79 88 { 89 gettimeofday(&starttime,NULL); 80 90 line[strlen(line)-1] = '\0'; 81 91 strcpy(segment[segcount],line); … … 90 100 if(strcmp(segtype,"EOS")==0) 91 101 { 102 gettimeofday(&afterinput,NULL); 92 103 dgp1(); // parametry!!! MGraph, SGraph, Grammar 104 gettimeofday(&afterparse,NULL); 93 105 output(); 106 gettimeofday(&endtime,NULL); 107 108 if(printtimeinfo) 109 { 110 fprintf(stderr,"### INPUT TIME: %10.2fms\n", (float)MICROSECONDSELAPSED(starttime,afterinput)/1000 ); 111 fprintf(stderr,"### PARSE TIME: %10.2fms\n", (float)MICROSECONDSELAPSED(afterinput,afterparse)/1000 ); 112 fprintf(stderr,"### OUTPUT TIME: %10.2fms\n", (float)MICROSECONDSELAPSED(afterparse,endtime)/1000 ); 113 fprintf(stderr,"### TOTAL TIME: %10.2fms\n", (float)MICROSECONDSELAPSED(starttime,endtime)/1000 ); 114 } 94 115 95 116 mgraph.clear(); -
src/dgp/sgraph.cc
re7de6cc ra15e59b 148 148 if(node.prop.forbidden[i]) buf+=sprintf(buf,"%s!%s",(cont++)?",":"",i.str()); 149 149 for(Role i=1; i<=Role::count(); ++i) 150 if(node.prop.required[i]) buf+=sprintf(buf,"%s &%s",(cont++)?",":"",i.str());150 if(node.prop.required[i]) buf+=sprintf(buf,"%s-%s",(cont++)?",":"",i.str()); 151 151 for(Role i=1; i<=Role::count(); ++i) 152 152 if(node.prop.attached[i]) buf+=sprintf(buf,"%s+%s",(cont++)?",":"",i.str());
Note: See TracChangeset
for help on using the changeset viewer.