source: app/src/kor/common_cor.cc @ f7b30b9

Last change on this file since f7b30b9 was 40358d2, checked in by obrebski <obrebski@…>, 17 years ago

lem, gue, kor, cor sprawdzaja czy slownik istnieje i da sie otworzyc

git-svn-id: svn://atos.wmid.amu.edu.pl/utt@47 e293616e-ec6a-49c2-aa92-f4a8b91c5d16

  • Property mode set to 100755
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.