| Line | |
|---|
| 1 | #include <stdlib.h> |
|---|
| 2 | #include <string.h> |
|---|
| 3 | #include "common_cor.h" |
|---|
| 4 | |
|---|
| 5 | #define MAX_PATH_LENGTH 255 |
|---|
| 6 | |
|---|
| 7 | char dictionary[MAX_PATH_LENGTH]; |
|---|
| 8 | char file_weights[MAX_PATH_LENGTH]; |
|---|
| 9 | float threshold; |
|---|
| 10 | bool show_scores = false; |
|---|
| 11 | int result_count; |
|---|
| 12 | |
|---|
| 13 | void process_cor_options(gengetopt_args_info* args) |
|---|
| 14 | { |
|---|
| 15 | if(args->dictionary_given) |
|---|
| 16 | { |
|---|
| 17 | expand_path(args->dictionary_arg,dictionary); |
|---|
| 18 | if(file_accessible(dictionary)!=0) |
|---|
| 19 | { |
|---|
| 20 | fprintf(stderr,"Cannot open the dictionary file: %s\nAborting.\n",dictionary); |
|---|
| 21 | exit(1); |
|---|
| 22 | } |
|---|
| 23 | } |
|---|
| 24 | else if (args->dictionary_home_given && args->language_given) |
|---|
| 25 | { |
|---|
| 26 | char buf[MAX_PATH_LENGTH]; |
|---|
| 27 | expand_path(args->dictionary_home_arg, buf); |
|---|
| 28 | sprintf(dictionary,"%s/%s/cor.bin",buf,args->language_arg); |
|---|
| 29 | if(file_accessible(dictionary)!=0) |
|---|
| 30 | { |
|---|
| 31 | fprintf(stderr,"Cannot open the dictionary file: %s\nAborting.\n",dictionary); |
|---|
| 32 | exit(1); |
|---|
| 33 | } |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | expand_path(args->weights_arg, file_weights); |
|---|
| 37 | |
|---|
| 38 | threshold = args->threshold_arg; |
|---|
| 39 | |
|---|
| 40 | show_scores = args->show_scores_flag; |
|---|
| 41 | |
|---|
| 42 | if(args->count_given) { |
|---|
| 43 | result_count = args->count_arg; |
|---|
| 44 | } |
|---|
| 45 | else { |
|---|
| 46 | result_count = 0; |
|---|
| 47 | } |
|---|
| 48 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.