Changeset 10c74af for app/src/gue/main.cc
- Timestamp:
- 05/07/08 20:37:46 (17 years ago)
- Branches:
- master, help
- Children:
- 028d99f
- Parents:
- 6b3be72
- git-author:
- obrebski <obrebski@…> (05/07/08 20:37:46)
- git-committer:
- obrebski <obrebski@…> (05/07/08 20:37:46)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
app/src/gue/main.cc
r8abee07 r10c74af 117 117 char* parms_end = parms; 118 118 char last_lemma[MAX_LINE]; 119 120 while ((i=tab.next()) != -1 && count++<guess_count) { 121 /* if we have "one-line" flag then everything goes in one segment as many fields, 122 * if we have "one-field" flag everything goes in one segment as ONE field: 123 * - diferent lemmas are separated with ';', sequent descriptions to one lemma 124 * are separated with ',' 125 */ 126 if ((!first) && (tab[i].w_suf() < cut_off) || (tab[i].w_suf() < delta * last_weight)) { 119 120 count = 1; 121 122 while (count < tab.count() && count <= guess_count) 123 if (first || tab[count].w_suf() >= cut_off && tab[count].w_suf() >= delta * last_weight) 124 { 125 first=0; 126 last_weight = tab[i].w_suf(); 127 count++; 128 } 129 else 127 130 break; 131 132 // drukujemy count pierwszych z tab 133 134 135 if(one_line) 136 { 137 char* descp=desc; 138 for (int i=0; i< count; ++i) 139 { 140 descp += sprintf(descp," %s%s,%s", output_field_prefix, tab[i].lemma(), tab[i].descr()); 141 if(weights) descp += sprintf(descp,":%d",(int)tab[i].w_suf()); 142 } 143 strcpy(outline,line); 144 outline[strlen(outline)-1]='\0'; 145 strcat(outline,desc); 146 strcat(outline,"\n"); 147 fputs(outline, outputf); 148 if (copy_processed) 149 fputs(line,outputf); 128 150 } 129 if (first) { 130 parms_end += sprintf(parms_end, "%s", field_prefix); 131 } else if (!args.one_field_flag) 132 parms_end += sprintf(parms_end, "%s", field_prefix); 133 134 if (!args.one_field_flag || strcmp(last_lemma, tab[i].lemma()) != 0) { 135 if (args.one_field_flag && !first) 136 parms_end += sprintf(parms_end, ";"); 137 parms_end += sprintf(parms_end, "%s", tab[i].lemma()); 138 strcpy(last_lemma, tab[i].lemma()); 151 else if(one_field) 152 { 153 char* descp=desc; 154 for (int i=0; i< count; ++i) 155 if(i==0) 156 { 157 descp += sprintf(descp," %s%s,%s", output_field_prefix, tab[i].lemma(), tab[i].descr()); 158 if(weights) descp += sprintf(descp,":%d",(int)tab[i].w_suf()); 159 } 160 else 161 { 162 if(strcmp(tab[i].lemma(),tab[i-1].lemma())==0) 163 descp += sprintf(descp,",%s",tab[i].descr()); 164 else 165 descp += sprintf(descp,";%s,%s",tab[i].lemma(),tab[i].descr()); 166 if(weights) descp += sprintf(descp,":%d",(int)tab[i].w_suf()); 167 } 168 169 strcpy(outline,line); 170 outline[strlen(outline)-1]='\0'; 171 strcat(outline,desc); 172 strcat(outline,"\n"); 173 fputs(outline, outputf); 174 if (copy_processed) 175 fputs(line,outputf); 139 176 } 140 141 first=0; 142 143 last_weight = tab[i].w_suf(); 144 if (!weights) 145 parms_end += sprintf(parms_end, ",%s:%d", tab[i].descr(), (int)tab[i].w_suf()); 146 else 147 parms_end += sprintf(parms_end, ",%s", tab[i].descr()); 148 149 if (!args.one_field_flag) { 150 seg.addfield(parms); 151 parms_end = parms; 177 else 178 { 179 for (int i=0; i< tab.count(); ++i) 180 { 181 // kolejne opisy - kolejne linie. 182 char* descp=desc; 183 descp += sprintf(desc, " %s%s,%s\n", output_field_prefix, tab[i].lemma(), tab[i].descr()); 184 if(weights) descp += sprintf(descp,":%d",(int)tab[i].w_suf()); 185 strcpy(outline,line); 186 outline[strlen(outline)-1]='\0'; 187 strcat(outline,desc); 188 fputs(outline, outputf); 189 } 190 if (copy_processed) 191 fputs(line,outputf); 152 192 } 153 154 if (!(args.one_field_flag || args.one_line_flag)) { 155 seg.print(outline); 156 fputs(outline, outputf); 157 --seg.auxn; 158 } 159 //if (copy_processed) 160 // fputs(outline, stdout); 161 } //while 162 163 if (args.one_field_flag) 164 seg.addfield(parms); 165 166 if (args.one_field_flag || args.one_line_flag){ 167 seg.print(outline); 168 fputs(outline, outputf); 169 } 170 } else { // if (process_segment) 171 // jak to nie jest wyraz - to przepisz token na wyjscie. 172 // printtok(line, start, len, cat, form); 173 seg.print(outline); 174 fputs(outline, outputf); 175 if (copy_processed) 176 fputs(outline, stdout); 177 } 193 } 178 194 } 179 time_t end_time = time(NULL); 180 if (per_info) { 181 printf("Liczba s³ów: %d\n", words_count); 182 printf("Czas analizy: %d sekund\n", end_time-start_time); 183 } 184 cmdline_parser_free(&args); 195 if(args.interactive_flag) 196 fflush(outputf), fflush(failedf); 197 185 198 } 186 199 cmdline_parser_free(&args); 200 } 201 202 203 204 205 206 207 208 209 // while ((i=tab.next()) != -1 && count++<guess_count) { 210 // /* if we have "one-line" flag then everything goes in one segment as many fields, 211 // * if we have "one-field" flag everything goes in one segment as ONE field: 212 // * - diferent lemmas are separated with ';', sequent descriptions to one lemma 213 // * are separated with ',' 214 // */ 215 // if ((!first) && (tab[i].w_suf() < cut_off) || (tab[i].w_suf() < delta * last_weight)) { 216 // break; 217 // } 218 // if (first) { 219 // parms_end += sprintf(parms_end, "%s", output_field_prefix); 220 // } else if (!args.one_field_flag) 221 // parms_end += sprintf(parms_end, "%s", output_field_prefix); 222 223 // if (!args.one_field_flag || strcmp(last_lemma, tab[i].lemma()) != 0) { 224 // if (args.one_field_flag && !first) 225 // parms_end += sprintf(parms_end, ";"); 226 // parms_end += sprintf(parms_end, "%s", tab[i].lemma()); 227 // strcpy(last_lemma, tab[i].lemma()); 228 // } 229 230 // first=0; 231 232 // last_weight = tab[i].w_suf(); 233 // if (!weights) 234 // parms_end += sprintf(parms_end, ",%s:%d", tab[i].descr(), (int)tab[i].w_suf()); 235 // else 236 // parms_end += sprintf(parms_end, ",%s", tab[i].descr()); 237 238 // if (!args.one_field_flag) { 239 // seg.addfield(parms); 240 // parms_end = parms; 241 // } 242 243 // if (!(args.one_field_flag || args.one_line_flag)) { 244 // seg.print(outline); 245 // fputs(outline, outputf); 246 // --seg.auxn; 247 // } 248 // //if (copy_processed) 249 // // fputs(outline, stdout); 250 // } //while 251 252 // if (args.one_field_flag) 253 // seg.addfield(parms); 254 255 // if (args.one_field_flag || args.one_line_flag){ 256 // seg.print(outline); 257 // fputs(outline, outputf); 258 // } 259 // } else { // if (process_segment) 260 // // jak to nie jest wyraz - to przepisz token na wyjscie. 261 // // printtok(line, start, len, cat, form); 262 // seg.print(outline); 263 // fputs(outline, outputf); 264 // if (copy_processed) 265 // fputs(outline, stdout); 266 // } 267 // } 268 // time_t end_time = time(NULL); 269 // if (per_info) { 270 // printf("Liczba s³ów: %d\n", words_count); 271 // printf("Czas analizy: %d sekund\n", end_time-start_time); 272 // } 273 // cmdline_parser_free(&args); 274 // } 275
Note: See TracChangeset
for help on using the changeset viewer.