source: src/kor/common_cor.cc @ b97a556

Last change on this file since b97a556 was 5f4d9c3, checked in by Maciej Prill <mprill@…>, 13 years ago

Rewritten the build system, added lem UTF-8 version.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1#include <stdlib.h>
2#include <string.h>
3#include "common_cor.h"
4
5#define MAX_PATH_LENGTH 255
6
7char dictionary[MAX_PATH_LENGTH];
8char file_weights[MAX_PATH_LENGTH];
9float threshold;
10bool show_scores = false;
11int result_count;
12
13void 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.