-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_main.cpp
executable file
·42 lines (37 loc) · 1.19 KB
/
test_main.cpp
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
#include <locale.h>
#include <stdio.h>
#include "parser/link_parser/link-includes.h"
int main()
{
Dictionary dict;
Parse_Options opts;
Sentence sent;
Linkage linkage;
char * diagram;
int i, num_linkages;
char * input_string[] = {
"Grammar is useless because there is nothing to say -- Gertrude Stein.",
"Computers are useless; they can only give you answers -- Pablo Picasso."};
setlocale(LC_ALL, "");
opts = parse_options_create();
dict = dictionary_create_lang("en");
if (!dict) {
printf ("Fatal error: Unable to open the dictionary\n");
return 1;
}
for (i=0; i<2; ++i) {
sent = sentence_create(input_string[i], dict);
sentence_split(sent, opts);
num_linkages = sentence_parse(sent, opts);
if (num_linkages > 0) {
linkage = linkage_create(0, sent, opts);
printf("%s\n", diagram = linkage_print_diagram(linkage));
linkage_free_diagram(diagram);
linkage_delete(linkage);
}
sentence_delete(sent);
}
dictionary_delete(dict);
parse_options_delete(opts);
return 0;
}