-
Notifications
You must be signed in to change notification settings - Fork 0
/
treebank.h
125 lines (104 loc) · 3 KB
/
treebank.h
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#ifndef TREEBANK_H
#define TREEBANK_H
struct tb_edge
{
int id, from, to;
char *sign; // uses lexical types on leaves
char *sign_with_lexnames; // uses lexeme names on leaves
int npack, ndaughters;
struct tb_edge **pack, **daughter;
struct tb_token **tokens;
int ntokens;
int nparents;
int is_root;
struct tb_edge **parents;
struct tb_edge *host; // edge this is packed onto
long long unpackings; // how many ways to unpack this edge
long long solutions; // how many ways to unpack a root using this edge
};
struct tb_token
{
wchar_t *text;
char *avmstr;
int from, to;
int cfrom, cto;
int id;
};
struct parse
{
int nedges, nroots;
struct tb_edge **edges, **roots;
int ntokens;
struct tb_token **tokens;
};
enum
{
constraintIsAConstituent = 1,
constraintExactly = 2,
constraintPresent = 3,
constraintAbsent = 4
};
struct constraint
{
char *sign;
int from, to;
int type;
int inferred;
};
struct session
{
char *profile_id, *item_id;
char *input;
char *parse_id;
struct parse *parse;
int id;
struct tree *pref_tree;
int nlocal_dec;
struct constraint *local_dec;
int ngold_dec;
struct constraint *gold_dec;
char *gold_active;
char *comment;
struct timeval t_start;
//int nislands;
//struct tb_edge **islands;
};
struct disc
{
char *sign;
long long count;
int from, to;
int lexical;
};
void get_discriminants(struct parse *P, int from, int to, long long ntrees, int *Nd, struct disc **D);
struct parse *do_unary_closure(struct parse *Pin);
struct session *get_session(int id);
long long count_remaining_trees(struct parse *P, struct constraint *c, int nc);
struct session *get_session(int id);
void free_parse(struct parse *P);
struct tsdb *cached_get_profile_and_pin(char *path);
char *get_pid_by_id(struct tsdb *profile, char *i_id);
char *get_pref_rid(struct tsdb *profile, char *pid);
char *get_result(struct tsdb *profile, char *pid, char *rid);
int get_decisions(struct tsdb *profile, char *pid, struct constraint **Decs);
struct parse *load_forest(struct tsdb *profile, char *pid);
struct tree *extract_tree(struct tb_edge *e, int ucdepth);
void add_bridge_suppression(struct parse *p, struct constraint **Decs, int *Ndecs);
int get_t_active(char *prof_id, char *parse_id);
int get_t_active_p(struct tsdb *t, char *parse_id);
char *get_t_comment(char *prof_id, char *parse_id);
char *get_t_comment_p(struct tsdb *t, char *parse_id);
char *get_t_start(char *prof_id, char *parse_id);
char *get_t_start_p(struct tsdb *t, char *parse_id);
char *get_t_end(char *prof_id, char *parse_id);
char *get_t_end_p(struct tsdb *t, char *parse_id);
int write_tree(char *prof_path, char *parse_id, char *t_version, char *t_active, char *author, char *comment, char *t_start, char *t_end);
char *get_parse_id_p(struct tsdb *t, char *item_id);
char *status_string(int t_active);
char *status_color(int t_active);
int iid_is_active(char *iid);
char *get_gold_profile_path(char *profile_id);
extern char *tsdb_home_path;
extern char *grammar_ace_image_path;
extern char *grammar_roots;
#endif