|
1
|
(*
|
|
2
3
4
|
* ENIAMwalenty, a converter for Polish Valence Dictionary "Walenty".
* Copyright (C) 2016-2017 Wojciech Jaworski <wjaworski atSPAMfree mimuw dot edu dot pl>
* Copyright (C) 2016-2017 Institute of Computer Science Polish Academy of Sciences
|
|
5
|
*
|
|
6
7
|
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
|
|
8
9
10
|
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
|
|
11
|
* This library is distributed in the hope that it will be useful,
|
|
12
13
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
* GNU Lesser General Public License for more details.
|
|
15
|
*
|
|
16
|
* You should have received a copy of the GNU Lesser General Public License
|
|
17
18
19
20
21
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*)
open Xstd
|
|
22
23
|
type opinion = Pewny | Potoczny | Watpliwy | Archaiczny | Zly | Wulgarny | Nieokreslony
| Metaforyczny | Dziedzinowy | Sporadyczny | OpinionUndef
|
|
24
|
type negation = Negation | Aff | NegationUndef | NegationNA
|
|
25
|
type pred = PredTrue | PredFalse | PredUndef | PredNA
|
|
26
27
28
|
type aspect = Aspect of string | AspectUndef | AspectNA
type case = Case of string | Str | Part | CaseAgr | NomAgr | GenAgr | AllAgr | CaseUndef | AllUAgr | CaseUAgr
type comp = Comp of string | Zeby | Gdy | CompUndef
|
|
29
|
type comp_type = Int | Rel | CompTypeUndef
|
|
30
31
|
type number = Number of string | NumberUndef | NumberAgr
type gender = Gender of string | GenderUndef | GenderAgr | Genders of string list
|
|
32
|
type grad = Grad of string | GradUndef
|
|
33
|
type refl = ReflEmpty | ReflTrue | ReflFalse | ReflUndef
|
|
34
|
(* type acm = Acm of string | AcmUndef *)
|
|
35
|
|
|
36
|
type gf = SUBJ | OBJ | ARG
|
|
37
|
|
|
38
|
type pos =
|
|
39
|
SUBST of number * case
|
|
40
41
42
|
| PPRON12 of number * case
| PPRON3 of number * case
| SIEBIE of case
|
|
43
|
| PREP of case
|
|
44
|
| NUM of case * gender (* acm*)
|
|
45
46
|
| ADJ of number * case * gender * grad
| ADV of grad
|
|
47
48
|
| GER of number * case * gender * aspect * negation (** refl*)
| PACT of number * case * gender * aspect * negation (* refl*)
|
|
49
|
| PPAS of number * case * gender * aspect * negation
|
|
50
|
| INF of aspect * negation (* refl*)
|
|
51
52
53
|
| QUB
| COMPAR
| COMP of comp_type
|
|
54
|
| PERS of (*number * gender * aspect * person * *)negation (* refl*)
|
|
55
|
| FIXED
|
|
56
57
|
type phrase =
|
|
58
|
NP of case
|
|
59
|
| PrepNP of string * case
|
|
60
|
| AdjP of case
|
|
61
|
| PrepAdjP of string * case
|
|
62
|
| NumP of case
|
|
63
64
|
| PrepNumP of string * case
| ComprepNP of string
|
|
65
|
| ComparP of string (** case*)
|
|
66
67
|
| CP of comp_type * comp
| NCP of case * comp_type * comp
|
|
68
69
|
| PrepNCP of string * case * comp_type * comp
| InfP of aspect
|
|
70
|
| AdvP of string
|
|
71
|
| FixedP of string
|
|
72
|
(* | Num of case (* acm*) *)
|
|
73
74
|
| Or
| Qub
|
|
75
76
|
(* | Pro
| ProNG *)
|
|
77
|
| Null
|
|
78
79
80
81
82
|
| GerP of case
| PrepGerP of string * case
| PpasP of case
| PrepPpasP of string * case
| PactP of case
|
|
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
type phrase_abbr =
Xp of string
| Nonch
| Distrp
| Possp
type phrase_comp =
Cp
| Ncp of case
| Prepncp of string * case
type lex =
Lexeme of string
| ORconcat of lex list
| ORcoord of lex list
| XOR of lex list
| Elexeme of gender
|
|
101
|
|
|
102
|
type restr = Natr | Ratr | Ratrs | Ratr1 | Atr | Atr1 | NoRestr
|
|
103
|
|
|
104
105
106
107
108
109
110
|
type sel_prefs =
SynsetId of int
| Predef of string
| RelationArgId of string * int (* nazwa relacji * id argumentu ramy *)
| RelationRole of string * string * string (* relacji * rola * atrybut roli *)
type position = {psn_id: int; gf: gf; role: string; role_attr: string; sel_prefs: sel_prefs list;
|
|
111
112
113
114
115
116
117
118
119
120
121
|
mode: string list; cr: string list; ce: string list; morfs: morf list}
and morf =
Phrase of phrase
| E of phrase
| LexPhrase of (pos * lex) list * (restr * position list)
| PhraseAbbr of phrase_abbr * morf list
| PhraseComp of phrase_comp * (comp_type * comp list)
| MorfId of int
| SimpleLexArg of string * pos
| LexArg of int * string * pos
|
|
122
123
|
let empty_position =
|
|
124
|
{psn_id=(-1); gf=ARG; role=""; role_attr=""; mode=[]; sel_prefs=[]; cr=[]; ce=[]; morfs=[]}
|
|
125
|
|
|
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
type lex_record = {
lex_argument: morf;
lex_arguments: morf list;
lex_lemma: lex;
lex_numeral_lemma: lex;
lex_mode: string list;
lex_negation: negation;
lex_degree: grad;
lex_number: number;
lex_reflex: refl;
lex_gender: gender;
lex_modification: restr * position list;
}
let empty_lex = {lex_argument=Phrase Null; lex_arguments=[]; lex_lemma=Lexeme "";
lex_numeral_lemma=Lexeme ""; lex_mode=[]; lex_negation=NegationUndef;
lex_degree=GradUndef; lex_number=NumberUndef; lex_reflex=ReflUndef;
lex_gender=GenderUndef; lex_modification = Natr,[]}
|
|
145
146
147
148
149
150
151
152
153
154
155
156
|
type meaning = {mng_id: int;
name: string;
variant: string;
plwnluid: int;
gloss: string}
let empty_meaning = {mng_id = (-1);
name = "";
variant = "";
plwnluid = (-1);
gloss = ""}
|
|
157
|
type schema = {sch_id: int; opinion: opinion; reflexiveMark: bool; aspect: aspect;
|
|
158
159
|
negativity: negation; predicativity: pred; positions: position list; text_rep: string}
|
|
160
161
|
type lex_entry =
SimpleLexEntry of string * string
|
|
162
163
|
| LexEntry of int * string * string * restr * position list
| ComprepNPEntry of string * restr * position list
|
|
164
|
|
|
165
|
|
|
166
|
module OrderedEntry = struct
|
|
167
|
type t = lex_entry
|
|
168
169
170
171
|
let compare = compare
end
module EntrySet = Xset.Make(OrderedEntry)
|
|
172
|
|
|
173
174
175
176
|
module OrderedAbbr = struct
type t = phrase_abbr
let compare = compare
end
|
|
177
|
|
|
178
|
module AbbrMap = Xmap.Make(OrderedAbbr)
|
|
179
|
|
|
180
181
182
183
|
module OrderedComp = struct
type t = comp_type
let compare = compare
end
|
|
184
|
|
|
185
|
module CompMap = Xmap.Make(OrderedComp)
|
|
186
|
|
|
187
|
type example = {exm_id: int;
|
|
188
189
|
meaning: int;
phrases: (int * int * int) list;
|
|
190
191
192
193
194
|
sentence: string;
source: string;
opinion: opinion;
note: string}
|
|
195
|
type argument = {arg_id: int;
|
|
196
197
|
role: string;
role_attribute: string;
|
|
198
|
sel_prefs: sel_prefs list}
|
|
199
|
|
|
200
|
type frame = {frm_id: int;
|
|
201
|
opinion: opinion;
|
|
202
|
meanings: int list;
|
|
203
204
|
arguments: argument list}
|
|
205
206
207
208
|
type connection = {argument: int;
phrases: (int * int list) list}
type alternation = {schema: int; frame: int; connections: connection list}
|
|
209
|
|
|
210
|
type entry = {ent_id: int;
|
|
211
212
213
214
215
|
status: string;
form_orth: string;
form_pos: string;
schemata: schema list;
examples: example list;
|
|
216
|
frames: frame list;
|
|
217
|
meanings: meaning list;
|
|
218
|
alternations: alternation list}
|
|
219
|
|
|
220
|
let empty_entry = {ent_id=(-1); status=""; form_orth=""; form_pos=""; schemata=[]; examples=[];
|
|
221
|
frames=[]; meanings=[]; alternations=[]}
|