- Timestamp:
- 04/01/08 21:42:34 (17 years ago)
- Branches:
- master, help
- Children:
- 317d53b
- Parents:
- e2bde98
- git-author:
- obrebski <obrebski@…> (04/01/08 21:42:34)
- git-committer:
- obrebski <obrebski@…> (04/01/08 21:42:34)
- Location:
- app/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
app/src/gue/main.cc
r25ae32e r8abee07 15 15 int main(int argc, char** argv) { 16 16 17 int non_standard_config=0;17 // int non_standard_config=0; 18 18 19 19 gengetopt_args_info args; … … 23 23 24 24 process_config_files(&args,argv[0]); 25 26 25 process_common_options(&args,argv[0]); 27 26 process_guess_options(&args); … … 73 72 char parms[MAX_LINE], desc[MAX_LINE], lemma[MAX_LINE]; 74 73 long line_count = 0; 75 // printf("d_f=%s\n", dict_file);74 76 75 Guess guess(dictionary); 77 76 int words_count=0; 78 77 time_t start_time = time(NULL); 78 79 // Segment seg; 80 Words tab; 81 while (fgets(line, MAX_LINE, inputf)) 82 { 83 line_count++; 84 int start, len; 85 86 line[strlen(line)-1] = '\0'; 87 88 if (!process_seg(line, args)) 89 fputs(line,outputf); 90 else 91 { 92 char form[MAX_FORM]; 93 words_count++; 94 tab.clear(); 95 getfield(line,input_field_prefix,form); 96 if (form==NULL) continue;//BZDURA 97 98 guess.ana(form, tab); 99 100 if ((tab.count()==0) && (!args.no_fail_flag)) // no guesses - analysis was unsuccessful 101 fputs(line, failedf); 102 else 103 { 79 104 80 Segment seg; 81 Words tab; 82 char* form; //[MAX_FORM]; 83 while (fgets(line, MAX_LINE, inputf)==line) { 84 line_count++; 85 int start, len; 105 // if (copy_processed) 106 // fputs(line, stdout); 107 // continue; 108 // } 109 // we've got some guesses. Do we want to print it? 110 // if (args.only_fail_flag) 111 // continue; 86 112 87 line[strlen(line)-1] = '\0'; 88 89 if (!seg.parse(line)) { 90 fprintf(stderr, "B³±d w wej¶ciu (linia: %d)\n", line_count); 91 return -1; 113 float last_weight=0; 114 int i=0; 115 int count=0; 116 unsigned first=1; 117 char* parms_end = parms; 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)) { 127 break; 128 } 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()); 139 } 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; 152 } 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 } 178 } 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); 92 185 } 93 94 if (process_seg(seg, args)) { 95 words_count++; 96 tab.clear(); 97 if (args.input_field_given>0) { 98 form = getInput(args.input_field_arg, args.input_field_given, seg); 99 } else 100 form = seg.form; 101 102 if (NULL == form) { 103 continue; 104 } 105 106 guess.ana(form, tab); 107 108 if ((tab.count()==0) && (!args.no_fail_flag)) { 109 // no guesses - analysis was unsuccessful 110 seg.print(outline); //this is necessary - seg.parse destroys line... 111 fputs(outline, failedf); 112 if (copy_processed) 113 fputs(line, stdout); 114 continue; 115 } 116 // we've got some guesses. Do we want to print it? 117 if (args.only_fail_flag) 118 continue; 119 120 float last_weight=0; 121 int i=0; 122 int count=0; 123 unsigned first=1; 124 char* parms_end = parms; 125 char last_lemma[MAX_LINE]; 126 127 while ((i=tab.next()) != -1 && count++<guess_count) { 128 /* if we have "one-line" flag then everything goes in one segment as many fields, 129 * if we have "one-field" flag everything goes in one segment as ONE field: 130 * - diferent lemmas are separated with ';', sequent descriptions to one lemma 131 * are separated with ',' 132 */ 133 if ((!first) && (tab[i].w_suf() < cut_off) || (tab[i].w_suf() < delta * last_weight)) { 134 break; 135 } 136 if (first) { 137 parms_end += sprintf(parms_end, "%s", field_prefix); 138 } else if (!args.one_field_flag) 139 parms_end += sprintf(parms_end, "%s", field_prefix); 140 141 if (!args.one_field_flag || strcmp(last_lemma, tab[i].lemma()) != 0) { 142 if (args.one_field_flag && !first) 143 parms_end += sprintf(parms_end, ";"); 144 parms_end += sprintf(parms_end, "%s", tab[i].lemma()); 145 strcpy(last_lemma, tab[i].lemma()); 146 } 147 148 first=0; 149 150 last_weight = tab[i].w_suf(); 151 if (!weights) 152 parms_end += sprintf(parms_end, ",%s:%d", tab[i].descr(), (int)tab[i].w_suf()); 153 else 154 parms_end += sprintf(parms_end, ",%s", tab[i].descr()); 155 156 if (!args.one_field_flag) { 157 seg.addfield(parms); 158 parms_end = parms; 159 } 160 161 if (!(args.one_field_flag || args.one_line_flag)) { 162 seg.print(outline); 163 fputs(outline, outputf); 164 --seg.auxn; 165 } 166 //if (copy_processed) 167 // fputs(outline, stdout); 168 } //while 169 170 if (args.one_field_flag) 171 seg.addfield(parms); 172 173 if (args.one_field_flag || args.one_line_flag){ 174 seg.print(outline); 175 fputs(outline, outputf); 176 } 177 } else { // if (process_segment) 178 // jak to nie jest wyraz - to przepisz token na wyjscie. 179 // printtok(line, start, len, cat, form); 180 seg.print(outline); 181 fputs(outline, outputf); 182 if (copy_processed) 183 fputs(outline, stdout); 184 } 185 } 186 time_t end_time = time(NULL); 187 if (per_info) { 188 printf("Liczba s³ów: %d\n", words_count); 189 printf("Czas analizy: %d sekund\n", end_time-start_time); 190 } 191 cmdline_parser_free(&args); 192 } 186 -
app/src/kon/kon
r20b4e44 r8abee07 4 4 #component: kon (search context) 5 5 #version: 1.0 6 #author: Tomasz Obrebski6 #author: Justyna Walkowska 7 7 8 8 use strict; -
app/src/lem/main.cc
r25ae32e r8abee07 40 40 while (fgets(line, MAX_LINE, inputf)) 41 41 { 42 // strcpy(outline,line);43 42 ++line_count; 44 45 43 int start, len; 46 44 … … 53 51 tab.clear(); 54 52 getfield(line,input_field_prefix,form); 55 if (form==NULL) continue; 53 if (form==NULL) continue;//BZDURA 56 54 57 55 lem->ana(form, tab);
Note: See TracChangeset
for help on using the changeset viewer.