Changeset b3179eb for app/src/kor/main.cc
- Timestamp:
- 04/11/08 12:48:20 (17 years ago)
- Branches:
- master, help
- Children:
- aa9f1bc
- Parents:
- 635ee52
- git-author:
- pawelk <pawelk@…> (04/11/08 12:48:20)
- git-committer:
- pawelk <pawelk@…> (04/11/08 12:48:20)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
app/src/kor/main.cc
rac7d970 rb3179eb 77 77 tab.sort(); 78 78 79 int max_cnt = 0; 80 if(result_count < 1) { 81 max_cnt = tab.count(); 82 } 83 else { 84 max_cnt = (tab.count() < result_count) ? tab.count() : result_count; 85 } 86 79 87 if(args.replace_flag) 80 88 { … … 98 106 { 99 107 char* p=corfield; 100 for(int i=tab.count()-1; i >= 0; --i)108 for(int i=tab.count()-1; i >= tab.count()-max_cnt; --i) 101 109 { 102 110 if(tab[i].w_suf() > threshold) continue; 103 111 restorecasing(tab[i].form(),tab[i].form(),formcasing); 104 p += sprintf(p," %s%s,%1.2f",output_field_prefix,tab[i].form(),tab[i].w_suf()); 112 p += sprintf(p," %s%s",output_field_prefix,tab[i].form()); 113 if(show_scores) { 114 p += sprintf(p,",%1.2f",tab[i].w_suf()); 115 } 105 116 } 106 117 sprintf(p,"\n"); … … 115 126 char* p=corfield; 116 127 p += sprintf(p," %s",output_field_prefix); 117 for(int i=tab.count()-1; i >= 0; --i)128 for(int i=tab.count()-1; i >= tab.count()-max_cnt; --i) 118 129 { 119 130 if(tab[i].w_suf() > threshold) continue; 120 131 restorecasing(tab[i].form(),tab[i].form(),formcasing); 121 p += sprintf(p,(i==0)?"%s,%1.2f":";%s,%1.2f",tab[i].form(),tab[i].w_suf()); 132 p += sprintf(p,(i==0)?"%s":";%s",tab[i].form()); 133 if(show_scores) { 134 p += sprintf(p,",%1.2f",tab[i].w_suf()); 135 } 122 136 } 123 137 … … 131 145 else 132 146 { 133 for(int i=tab.count()-1; i >= 0; --i)147 for(int i=tab.count()-1; i >= tab.count()-max_cnt; --i) 134 148 { 135 149 if(tab[i].w_suf() > threshold) continue; 136 150 restorecasing(tab[i].form(),tab[i].form(),formcasing); 137 sprintf(corfield," %s%s,%1.2f\n",output_field_prefix,tab[i].form(),tab[i].w_suf()); 151 char* p = corfield; 152 p += sprintf(p," %s%s",output_field_prefix,tab[i].form()); 153 if(show_scores) { 154 p += sprintf(p,",%1.2f",tab[i].w_suf()); 155 } 156 p += sprintf(p, "\n"); 138 157 strcpy(outline,line); 139 158 outline[strlen(outline)-1]='\0';
Note: See TracChangeset
for help on using the changeset viewer.