execTypes.ml
4.39 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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
(*
* ENIAM: Categorial Syntactic-Semantic Parser for Polish
* Copyright (C) 2016 Wojciech Jaworski <wjaworski atSPAMfree mimuw dot edu dot pl>
* Copyright (C) 2016 Institute of Computer Science Polish Academy of Sciences
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*)
type status = Idle | PreprocessingError | LexiconError | ParseError | ParseTimeout | Parsed | TooManyNodes | NotParsed | NotReduced | ReductionError | SemError | NotTranslated
type eniam_parse_result = {
file_prefix: string;
status: status;
msg: string;
lex_time: float;
parse_time: float;
reduction_time: float;
sem_time: float;
paths_size: int;
chart_size: int;
dependency_tree_size: int;
chart: LCGtypes.chart;
dependency_tree: LCGtypes.linear_term array;
}
type conll_parse_result = {
file_prefix: string;
status: status;
msg: string;
lex_time: float;
parse_time: float;
reduction_time: float;
sem_time: float;
paths_size: int;
dependency_tree_size: int;
paths: (int * int * string) array;
dep_chart: LCGtypes.dep_tree;
parsed_dep_chart: (LCGtypes.SymbolMap.key * LCGtypes.linear_term) list;
not_parsed_dep_chart: int *
(LCGtypes.grammar_symbol * LCGtypes.linear_term) list list *
(LCGtypes.grammar_symbol * LCGtypes.linear_term) list *
(LCGtypes.grammar_symbol * LCGtypes.linear_term) list list;
dependency_tree: LCGtypes.linear_term array;
}
type semantic_processing_result = {
file_prefix: string;
status: status;
msg: string;
sem_time: float;
disamb: LCGtypes.linear_term array;
sem: LCGtypes.linear_term array;
sem2: LCGtypes.linear_term array;
sem3: LCGtypes.linear_term;
trees: LCGtypes.linear_term list;
mrls: SemTypes.mrl_formula list;
}
type mode =
Raw | Struct | CONLL | ENIAM | Mate | Swigra | POLFIE
type sentence =
RawSentence of string
(* | CONLL of conll list *)
| StructSentence of (int * int * int) list * int (* (id * lnode * rnode) list * last *)
| DepSentence of (int * int * string) array (* (id * super * label) conll_id *)
| QuotedSentences of paragraph_record list
(* | NKJP1M of nkjp1m list *)
(* | Skladnica of skladnica_tree *)
| AltSentence of (mode * sentence) list (* string = etykieta np raw, nkjp, krzaki *)
| ENIAMSentence of eniam_parse_result
| CONLLSentence of conll_parse_result
| SemSentence of semantic_processing_result
and paragraph_record = {pid: string; pbeg: int; plen: int; pnext: int; psentence: sentence; pfile_prefix: string} (* beg i len liczone po znakach unicode ( * 100 ???) *)
and paragraph =
RawParagraph of string
| StructParagraph of paragraph_record list (* zdania *)
| AltParagraph of (mode * paragraph) list
type text =
RawText of string
| StructText of paragraph list
| AltText of (mode * text) list
type result = {
input_text: text;
pre_text: text;
pre_time1: float;
pre_time2: float;
status: status;
msg: string;
parse_time: float;
parsed_text: text;
semantic_time: float;
selected_sent_text: text;
semantic_text: text;
selected_semantic_text: text;
tokens: ENIAMtokenizerTypes.token_record ExtArray.t;
lex_sems: ENIAMlexSemanticsTypes.lex_sem ExtArray.t;
}
type sum_result = {
no_queries: int;
no_pre_error: int;
no_lex_error: int;
no_parse_error: int;
no_timeout: int;
no_reduction_error: int;
no_sem_error: int;
no_not_parsed: int;
no_not_reduced: int;
no_too_many_nodes: int;
no_not_translated: int;
no_parsed: int;
sum_pre_time1: float;
sum_pre_time2: float;
sum_lex_time: float;
sum_parse_time: float;
sum_reduction_time: float;
sum_sem_time: float;
}
type message_from_overseer =
Work_with of string * (*reg_params*)(string * float)
| Kill_yourself
type message_to_overseer =
Ready_to_work of string
| Work_done of
string * result
let time_fun = Unix.gettimeofday
(* let time_fun = Sys.time () *)