-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
48 lines (40 loc) · 1.27 KB
/
Copy pathmain.c
File metadata and controls
48 lines (40 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <locale.h>
#include <stdio.h>
#include "src/dict/dict.h"
#include "src/tui/tui.h"
int main(void)
{
/* MUST come before any ncurses call so the wide-character routines
* interpret the terminal's UTF-8 correctly — this is what makes
* Cyrillic render instead of turning into mojibake. */
setlocale(LC_ALL, "");
/*
if (argc < 3)
{
fprintf(stderr,
"usage: %s <reader-dict.index> <reader-dict.dict[.dz]> "
"[examples.index examples.dict[.dz]]\n",
argv[0]);
return 2;
}
const char *ex_index = (argc >= 5) ? argv[3] : NULL;
const char *ex_data = (argc >= 5) ? argv[4] : NULL;
*/
const char dict_index[] =
"/Users/admin/Documents/github.com/petrostrak/cdict/"
"rus-eng/rus-eng.index";
const char dict_data[] = "/Users/admin/Documents/github.com/petrostrak/cdict/"
"rus-eng/rus-eng.dict.dz";
DictDB *db = dict_open(dict_index, dict_data, NULL, NULL);
if (!db)
{
fprintf(stderr, "error: could not open dictionary files\n");
return 1;
}
/* When you wire up the Snowball stemmer, install it here:
* dict_set_lemmatizer(db, ru_lemma);
* dict_lookup() will then fall back to the lemma on a miss. */
int rc = tui_run(db);
dict_close(db);
return rc;
}