|
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
|
(*
* ENIAM_LCGgrammarPL is a library that provides LCG lexicon form 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 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This library 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*)
open Xstd
open ENIAM_LCGgrammarPLtypes
open ENIAM_LCGtypes
type rule =
Basic of string
| Quant of (cat * string) list * string
| Raised of (cat * string) list * string * cat list
| Quot of (cat * string) list * string
| Inclusion of string
| Conj of (cat * string) list * string
| Bracket of string
let symbol_weight = 1.
let measure_weight = 0.5
(* FIXME: "Można było" - brakuje uzgodnienia rodzaju przymiotnika w przypadku predykatywnym, i ogólnie kontroli składniowej *)
let grammar = [
(* symbole występujące w tekście - daty itp. i słowa określające ich typy *)
"lemma=dzień,pos=subst,number=sg,case=gen", Basic "day-lex/(date+day+day-month)",symbol_weight;
"lemma=dzień,pos=subst,number=sg", Basic "np*number*case*gender*person/(date+day+day-month)",symbol_weight;
"lemma=dzień,pos=subst,number=pl", Basic "np*number*case*gender*person/(date-interval+day-interval+day-month-interval)",symbol_weight;
"pos=date", Basic "date{schema}",symbol_weight;
"pos=date-interval", Basic "date-interval",symbol_weight;
"pos=day", Basic "day/month-lex",symbol_weight;
"pos=day-interval", Basic "day-interval/month-lex",symbol_weight;
"pos=day-month", Basic "day-month{schema}",symbol_weight;
"pos=day-month-interval", Basic "day-month-interval",symbol_weight;
"lemma=styczeń|luty|marzec|kwiecień|maj|czerwiec|lipiec|sierpień|wrzesień|październik|litopad|grudzień,pos=subst,number=sg,case=gen", Basic "month-lex/(1+year+np*T*gen*T*T)",symbol_weight;
"lemma=styczeń|luty|marzec|kwiecień|maj|czerwiec|lipiec|sierpień|wrzesień|październik|litopad|grudzień,pos=subst,number=sg", Basic "np*number*case*gender*person/year",symbol_weight;
"pos=month-interval", Basic "month-interval",symbol_weight;
"lemma=rok,pos=subst,number=sg",Basic "np*number*case*gender*person|year",symbol_weight;
"lemma=rok,pos=subst,number=pl",Basic "np*number*case*gender*person/year-interval",symbol_weight;
"pos=year", Basic "year",symbol_weight;
"pos=year-interval", Basic "year-interval",symbol_weight;
"lemma=wiek,pos=subst,number=sg",Basic "np*number*case*gender*person|roman",symbol_weight;
"lemma=wiek,pos=subst,number=pl",Basic "np*number*case*gender*person/roman-interval",symbol_weight;
"pos=roman", Basic "roman",symbol_weight;
"pos=roman-interval", Basic "roman-interval",symbol_weight;
"lemma=godzina,pos=subst,number=sg",Basic "np*number*case*gender*person/(hour+hour-minute)",symbol_weight;
"lemma=godzina,pos=subst,number=pl",Basic "np*number*case*gender*person/(hour-interval+hour-minute-interval)",symbol_weight;
"pos=hour-minute", Basic "hour-minute{schema}",symbol_weight;
"pos=hour", Basic "hour{schema}",symbol_weight;
"pos=hour-minute-interval", Basic "hour-minute-interval",symbol_weight;
"pos=hour-interval", Basic "hour-interval",symbol_weight;
"lemma=rysunek,pos=subst,number=sg",Basic "np*number*case*gender*person/obj-id",symbol_weight; (* objids *)
"pos=obj-id", Basic "obj-id",symbol_weight;
"pos=match-result", Basic "match-result",symbol_weight;
"pos=url", Basic "url",symbol_weight;
"pos=email", Basic "email",symbol_weight;
"pos=symbol", Basic "np*number*case*gender*person{\\(1+qub),/(1+inclusion)}",0.;
(* FIXME: uslalić kiedy schema jest pusta i wyciąć ją w takich przypadkach *)
(* frazy rzeczownikowe *)
"pos=subst|depr,nsyn!=pronoun,nsem!=measure",
Basic "np*number*case*gender*person{\\(1+num*number*case*gender*person*congr)}{schema}{\\(1+qub),/(1+inclusion)}",0.;
"pos=subst,case=gen,nsyn!=pronoun,nsem!=measure",
Quant([Number,"numbers";Case,"all_cases";Gender,"genders";Person,"persons"],
"np*sg*case*n2*person{\\num*number*case*gender*person*rec}{schema}{\\(1+qub),/(1+inclusion)}"), (* UWAGA: number "sg" i gender "n2", żeby uzgadniać z podmiotem czasownika *)0.;
"pos=subst,case=gen,nsyn!=pronoun,nsem!=measure",
Quant([Unumber,"all_numbers";Ucase,"all_cases";Ugender,"all_genders"; Uperson,"all_persons";Number,"numbers";Case,"all_cases";Gender,"genders";Person,"ter"],(* FIXME: "all_cases" *)
"np*unumber*ucase*ugender*uperson{\\measure*unumber*ucase*ugender*uperson}{schema}{\\(1+qub),/(1+inclusion)}"),0.;
"pos=subst|depr,nsyn=pronoun,nsem!=measure",
Basic "np*number*case*gender*person{\\(1+num*number*case*gender*person*congr)}{\\(1+qub),/(1+inclusion)}",0.;
"pos=subst,case=gen,nsyn=pronoun,nsem!=measure",
Quant([Number,"numbers";Case,"all_cases";Gender,"genders";Person,"persons"],
"np*sg*case*n2*person{\\num*number*case*gender*person*rec}{\\(1+qub),/(1+inclusion)}"), (* UWAGA: number "sg" i gender "n2", żeby uzgadniać z podmiotem czasownika *)0.;
"pos=subst,case=gen,nsyn=pronoun,nsem!=measure",
Quant([Unumber,"all_numbers";Ucase,"all_cases";Ugender,"all_genders"; Uperson,"all_persons";Number,"numbers";Case,"all_cases";Gender,"genders";Person,"ter"],
"np*unumber*ucase*ugender*uperson{\\measure*unumber*ucase*ugender*uperson}{\\(1+qub),/(1+inclusion)}"),0.;
"pos=ppron12",
Basic "np*number*case*gender*person{\\(1+qub),/(1+inclusion)}",0.;
"pos=ppron3,praep=npraep|praep-npraep",
Basic "np*number*case*gender*person{\\(1+qub),/(1+inclusion)}",0.;
"pos=siebie",
Basic "np*number*case*gender*person{\\(1+qub),/(1+inclusion)}",0.;
"lemma=jakiś|ten|taki,pos=apron",
Quant([Number,"numbers";Case,"cases";Gender,"genders";Person,"ter"],
"np*number*case*gender*person{\\(1+qub),/(1+inclusion)}"),0.;
(* liczebniki *)
(* FIXME: liczba po rzeczowniku *) (* FIXME: zbadać jak liczebniki współdziałąją z jako COMPAR *)
"pos=num|intnum|realnum|intnum-interval|realnum-interval",
Basic "num*number*case*gender*person*acm{\\(1+qub),/(1+inclusion)}", (* FIXME: jak usunięcie Phrase ProNG wpływa na pokrycie? *)0.;
(* pojemniki *)
"pos=subst,nsem=measure",
Basic "measure*number*case*gender*person{\\(1+num*number*case*gender*person*congr)}{schema}{\\(1+qub),/(1+inclusion)}",measure_weight;
"pos=subst,case=gen,nsem=measure",
Quant([Number,"numbers";Case,"all_cases";Gender,"genders";Person,"ter"],
"measure*sg*case*n2*person{\\num*number*case*gender*person*rec}{schema}{\\(1+qub),/(1+inclusion)}"),measure_weight;(* UWAGA: number "sg" i gender "n2", żeby uzgadniać z podmiotem czasownika *)
(* frazy przyimkowe *)
"pos=prep", Basic "prepnp*lemma*case{\\(1+advp),/np*T*case*T*T}{\\(1+qub),/(1+inclusion)}",0.;
"pos=prep", Basic "prepadjp*lemma*case{\\(1+advp),/adjp*T*case*T}{\\(1+qub),/(1+inclusion)}",0.;
"lemma=po,pos=prep", Quant([Case,"postp"],"prepadjp*lemma*case{\\(1+advp),/(adjp*sg*dat*m1+adjp*T*postp*T)}{\\(1+qub),/(1+inclusion)}"),0.;(* po polsku, po kreciemu *)
"lemma=z,pos=prep", Quant([Case,"postp"],"prepadjp*lemma*case{\\(1+advp),/adjp*sg*nom*f}{\\(1+qub),/(1+inclusion)}"),0.;(* z bliska *)
"lemma=na,pos=prep", Quant([Case,"postp"],"prepadjp*lemma*case{\\(1+advp),/advp}{\\(1+qub),/(1+inclusion)}"),0.;(* na lewo *)
(* przimkowe określenia czasu *)
"lemma=z,pos=prep,case=gen", Basic "prepnp*lemma*case{\\(1+advp),/(day-month+day+year+date+hour+hour-minute)}{\\(1+qub),/(1+inclusion)}",0.;
"lemma=do,pos=prep,case=gen", Basic "prepnp*lemma*case{\\(1+advp),/(day-month+day+year+date+hour+hour-minute)}{\\(1+qub),/(1+inclusion)}",0.;
"lemma=na,pos=prep,case=acc", Basic "prepnp*lemma*case{\\(1+advp),/(day-month+day+date+hour+hour-minute)}{\\(1+qub),/(1+inclusion)}",0.;
"lemma=o,pos=prep,case=loc", Basic "prepnp*lemma*case{\\(1+advp),/(hour+hour-minute)}{\\(1+qub),/(1+inclusion)}",0.;
"lemma=od,pos=prep,case=gen", Basic "prepnp*lemma*case{\\(1+advp),/(day-month+day+year+date+hour+hour-minute)}{\\(1+qub),/(1+inclusion)}",0.;
"lemma=około,pos=prep,case=gen", Basic "prepnp*lemma*case{\\(1+advp),/(day-month+day+year+date+hour+hour-minute)}{\\(1+qub),/(1+inclusion)}",0.;
"lemma=po,pos=prep,case=loc", Basic "prepnp*lemma*case{\\(1+advp),/(day-month+day+year+date+hour+hour-minute)}{\\(1+qub),/(1+inclusion)}",0.;
"lemma=przed,pos=prep,case=inst", Basic "prepnp*lemma*case{\\(1+advp),/(day-month+day+year+date+hour+hour-minute)}{\\(1+qub),/(1+inclusion)}",0.;
"lemma=w,pos=prep,case=loc", Basic "prepnp*lemma*case{\\(1+advp),/(day-month+day+year+date+hour+hour-minute)}{\\(1+qub),/(1+inclusion)}",0.;
(* komparatywy *) (* FIXME: trzeba poprawić comparnp i comparpp w walencji *)
"pos=compar", Quant([Case,"nom&gen&dat&acc&inst"],"compar*lemma*case{\\(1+advp),/np*T*case*T*T}{\\(1+qub),/(1+inclusion)}"),0.;
"pos=compar", Quant([Case,"postp"],"compar*lemma*case{\\(1+advp),/(prepnp*T*T+prepadjp*T*T)}{\\(1+qub),/(1+inclusion)}"),0.;
(* frazy przymiotnikowe *)
(* FIXME: check_frame_case - pamiętać o sprawdzaniu zgodności kategorii przy szukaniu schema *)
(* FIXME: let grad = match grads with [grad] -> grad | _ -> failwith "make_adjp: grad" in*)
"pos=adj|adjc|adjp", Basic "adjp*number*case*gender{schema}{\\(1+qub),/(1+inclusion)}{\\(1+adja)}",0.;
"lemma=jakiś|ten|taki,pos=apron", Basic "adjp*number*case*gender{\\(1+qub),/(1+inclusion)}",0.;
"pos=ordnum|roman-ordnum", Basic "adjp*number*case*gender{\\(1+qub),/(1+inclusion)}{\\(1+adja)}",0.;
"pos=adja|intnum|realnum|intnum-interval|realnum-interval|roman|roman-interval",Basic "adja/hyphen",0.;
(* przysłówki *)
(* FIXME let grad = match grads with [grad] -> grad | _ -> failwith "make_advp: grad" in*)
"pos=adv",Basic "advp{schema}{\\(1+qub),/(1+inclusion)}{\\(1+adja)}",0.;
(* relatory *)
(* FIXME: dwa znaczenia jak: pytanie o cechę lub spójnik *)
"lemma=jak|skąd|dokąd|gdzie|którędy|kiedy,pos=adv",
Raised([Inumber,"";Igender,"";Iperson,"";Ctype,"int&rel"],
"cp*ctype*lemma{\\(1+advp),/(ip*inumber*igender*iperson/advp)}",[Ctype]),0.; (*["CTYPE",SubstVar "ctype"]*)
"lemma=odkąd|dlaczego|czemu,pos=adv",
Raised([Inumber,"";Igender,"";Iperson,"";Ctype,"int"],
"cp*ctype*lemma{\\(1+advp),/(ip*inumber*igender*iperson/advp)}",[Ctype]),0.; (*["CTYPE",SubstVar "ctype"]*)
"lemma=gdy,pos=adv",
Raised([Inumber,"";Igender,"";Iperson,"";Ctype,"sub"],
"cp*ctype*lemma{\\(1+advp),/(ip*inumber*igender*iperson/advp)}",[Ctype]),0.; (*["CTYPE",SubstVar "ctype"]*)
(* czasowniki *)
"pos=ger", Basic "np*number*case*gender*person{schema}{\\(1+qub),/(1+inclusion)}",0.;
"pos=pact", Basic "adjp*number*case*gender{schema}{\\(1+qub),/(1+inclusion)}",0.;
"pos=ppas", Basic "adjp*number*case*gender{schema}{\\(1+qub),/(1+inclusion)}",0.;
"pos=fin|bedzie,negation=aff,mood=indicative", Basic "ip*number*gender*person{/(1+int)}{schema}{\\(1+qub),/(1+inclusion)}",0.;
"pos=fin|bedzie,negation=neg,mood=indicative", Basic "ip*number*gender*person{/(1+int)}{schema}{\\(1+qub),/(1+inclusion)}{\\nie}",0.;
"pos=fin,negation=aff,mood=imperative", Basic "ip*number*gender*person{/(1+int)}{schema,|aux-imp}{\\(1+qub),/(1+inclusion)}",0.;
"pos=fin,negation=neg,mood=imperative", Basic "ip*number*gender*person{/(1+int)}{schema,|aux-imp}{\\(1+qub),/(1+inclusion)}{\\nie}",0.;
"pos=impt|imps,negation=aff", Basic "ip*number*gender*person{/(1+int)}{schema}{\\(1+qub),/(1+inclusion)}",0.;
"pos=impt|imps,negation=neg", Basic "ip*number*gender*person{/(1+int)}{schema}{\\(1+qub),/(1+inclusion)}{\\nie}",0.;
"pos=pred,negation=aff,tense=pres", Basic "ip*number*gender*person{/(1+int)}{schema}{\\(1+qub),/(1+inclusion)}",0.;
"pos=pred,negation=neg,tense=pres", Basic "ip*number*gender*person{/(1+int)}{schema}{\\(1+qub),/(1+inclusion)}{\\nie}",0.;
"pos=pred,negation=aff,tense=fut", Basic "ip*number*gender*person{/(1+int)}{schema,|aux-fut*number*gender*person}{\\(1+qub),/(1+inclusion)}",0.;
"pos=pred,negation=neg,tense=fut", Basic "ip*number*gender*person{/(1+int)}{schema,|aux-fut*number*gender*person}{\\(1+qub),/(1+inclusion)}{\\nie}",0.;
"pos=pred,negation=aff,tense=past", Basic "ip*number*gender*person{/(1+int)}{schema,|aux-past*number*gender*person}{\\(1+qub),/(1+inclusion)}",0.; (* FIXME: tense *)
"pos=pred,negation=neg,tense=past", Basic "ip*number*gender*person{/(1+int)}{schema,|aux-past*number*gender*person}{\\(1+qub),/(1+inclusion)}{\\nie}",0.; (* FIXME: tense *)
"pos=praet|winien,person=ter,negation=aff,mood=indicative", Basic "ip*number*gender*person{/(1+int)}{schema}{\\(1+qub),/(1+inclusion)}",0.;
"pos=praet|winien,person=ter,negation=neg,mood=indicative", Basic "ip*number*gender*person{/(1+int)}{schema}{\\(1+qub),/(1+inclusion)}{\\nie}",0.;
"pos=praet|winien,person!=ter,negation=aff,mood=indicative", Basic "ip*number*gender*person{/(1+int)}{schema,|aglt*number*person}{\\(1+qub),/(1+inclusion)}",0.;
"pos=praet|winien,person!=ter,negation=neg,mood=indicative", Basic "ip*number*gender*person{/(1+int)}{schema,|aglt*number*person}{\\(1+qub),/(1+inclusion)}{\\nie}",0.;
"pos=praet|winien,person=ter,negation=aff,mood=conditional", Basic "ip*number*gender*person{/(1+int)}{schema,|by}{\\(1+qub),/(1+inclusion)}",0.;
"pos=praet|winien,person=ter,negation=neg,mood=conditional", Basic "ip*number*gender*person{/(1+int)}{schema,|by}{\\(1+qub),/(1+inclusion)}{\\nie}",0.;
"pos=praet|winien,person!=ter,negation=aff,mood=conditional", Basic "ip*number*gender*person{/(1+int)}{schema,|aglt*number*person,|by}{\\(1+qub),/(1+inclusion)}",0.;
"pos=praet|winien,person!=ter,negation=neg,mood=conditional", Basic "ip*number*gender*person{/(1+int)}{schema,|aglt*number*person,|by}{\\(1+qub),/(1+inclusion)}{\\nie}",0.;
"pos=praet|winien,negation=aff,tense=fut", Basic "ip*number*gender*person{/(1+int)}{schema,|aux-fut*number*gender*person}{\\(1+qub),/(1+inclusion)}",0.;
"pos=winien,person=ter,negation=aff,tense=past", Basic "ip*number*gender*person{/(1+int)}{schema,|aux-past*number*gender*person}{\\(1+qub),/(1+inclusion)}",0.;
"pos=winien,person=ter,negation=neg,tense=past", Basic "ip*number*gender*person{/(1+int)}{schema,|aux-past*number*gender*person}{\\(1+qub),/(1+inclusion)}{\\nie}",0.;
"pos=winien,person!=ter,negation=aff,tense=past", Basic "ip*number*gender*person{/(1+int)}{schema,|aglt*number*person,|aux-past*number*gender*person}{\\(1+qub),/(1+inclusion)}",0.;
"pos=winien,person!=ter,negation=neg,tense=past", Basic "ip*number*gender*person{/(1+int)}{schema,|aglt*number*person,|aux-past*number*gender*person}{\\(1+qub),/(1+inclusion)}{\\nie}",0.;
"pos=bedzie", Basic "aux-fut*number*gender*person",0.;
"lemma=być,pos=praet", Basic "aux-past*number*gender*person",0.;
"pos=aglt", Basic "aglt*number*person",0.;
"pos=inf,negation=aff", Basic "infp{schema}{\\(1+qub),/(1+inclusion)}",0.;
"pos=inf,negation=neg", Basic "infp{schema}{\\(1+qub),/(1+inclusion)}{\\nie}",0.;
"pos=pcon,negation=aff", Basic "padvp{schema}{\\(1+qub),/(1+inclusion)}",0.;
"pos=pcon,negation=neg", Basic "padvp{schema}{\\(1+qub),/(1+inclusion)}{\\nie}",0.;
"pos=pant,negation=aff", Basic "padvp{schema}{\\(1+qub),/(1+inclusion)}",0.;
"pos=pant,negation=neg", Basic "padvp{schema}{\\(1+qub),/(1+inclusion)}{\\nie}",0.;
"pos=comp", Quant([Ctype,"sub"],"cp*ctype*lemma/ip*T*T*T"),0.;
"pos=conj", Quant([Ctype,"coord"],"cp*ctype*lemma/ip*T*T*T"),0.;
"lemma=i|lub|czy|bądź,pos=conj", Conj([Number,"all_numbers";Gender,"all_genders";Person,"all_persons"],"(ip*number*gender*person/ip*T*T*T)\\ip*T*T*T"),0.;
"lemma=,|i|lub|czy|bądź,pos=conj", Conj([],"(advp/prepnp*T*T)\\prepnp*T*T"),0.;
"lemma=,|i|lub|czy|bądź,pos=conj", Conj([],"(advp/advp)\\prepnp*T*T"),0.;
"lemma=,|i|lub|czy|bądź,pos=conj", Conj([],"(advp/prepnp*T*T)\\advp"),0.;
"lemma=,|i|lub|czy|bądź,pos=conj", Conj([],"(advp/advp)\\advp"),0.;
"lemma=,|i|lub|czy|bądź,pos=conj", Conj([Plemma,"";Case,"all_cases"],"(prepnp*plemma*case/prepnp*plemma*case)\\prepnp*plemma*case"),0.;
"lemma=,|i|lub|czy|bądź,pos=conj", Conj([Number,"all_numbers";Case,"all_cases";Gender,"all_genders";Person,"all_persons"],"(np*number*case*gender*person/np*T*case*T*T)\\np*T*case*T*T"),0.;
"lemma=,|i|lub|czy|bądź,pos=conj", Conj([Number,"all_numbers";Case,"all_cases";Gender,"all_genders"],"(adjp*number*case*gender/adjp*number*case*gender)\\adjp*number*case*gender"),0.;
"lemma=co|kto,pos=subst",
Raised([Inumber,"";Igender,"";Iperson,"";Ctype,"int&rel";Number,"numbers";Case,"cases";Gender,"genders";Person,"ter"],
"cp*ctype*lemma/(ip*inumber*igender*iperson/np*number*case*gender*person)",[Ctype]),0.; (*["CTYPE",SubstVar "ctype"]*)
"lemma=co|kto,pos=subst",
Raised([Inumber,"";Igender,"";Iperson,"";Plemma,"";Ctype,"int&rel";Number,"numbers";Case,"cases";Gender,"genders";Person,"ter"],
"cp*ctype*lemma{/(ip*inumber*igender*iperson/prepnp*plemma*case),/(prepnp*plemma*case/np*number*case*gender*person)}",[Ctype]),0.; (*["CTYPE",SubstVar "ctype"]*)
"lemma=to,pos=subst",
Quant([Ctype,"";Plemma,"";Number,"numbers";Case,"cases";Gender,"genders";Person,"ter"],
"ncp*number*case*gender*person*ctype*plemma{\\(1+qub),/(1+inclusion)}{/cp*ctype*plemma}"),0.;
"pos=ppron3,praep=praep",
Raised([Plemma,"";Number,"numbers";Case,"cases";Gender,"genders";Person,"persons"],
"prepnp*plemma*case\\(prepnp*plemma*case/np*number*case*gender*person)",[]), (*inclusion*)0. (*[Number;Case;Gender;Person]*);
"lemma=ile,pos=num", (* FIXME: iloma ma bezpośredni podrzędnik rzeczownikowy, a ile nie *) (* FIXME: mwe "o ile, na ile" *)
Quant([Inumber,"";Igender,"";Iperson,"";Ctype,"int&rel";Number,"numbers";Case,"cases";Gender,"genders";Person,"ter"],
"cp*ctype*lemma/ip*inumber*igender*iperson"), (* FIXME: zaślepka, bo podrzędnik ile nie musi z nim sąciadować *)0.; (*["CTYPE",SubstVar "ctype"]*) (* FIXME: trzeba dodać przypadki, bezpośredniego podrzędnika rzeczownikowego i przyimka nad "ile" *)
"lemma=czyj|jaki|który,pos=apron",
Raised([Inumber,"";Igender,"";Iperson,"";Nperson,"";Ctype,"int";Number,"numbers";Case,"cases";Gender,"genders"],
|
|
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
|
"lemma=czyj|jaki,pos=apron",
Raised([Inumber,"";Igender,"";Iperson,"";Ctype,"rel";Number,"numbers";Case,"cases";Gender,"genders";Person,"ter"],
"cp*ctype*lemma/(ip*inumber*igender*iperson/np*number*case*gender*person)",[Ctype]),0.; (*["CTYPE",SubstVar "ctype"]*)
"lemma=jaki|który,pos=apron",
Raised([Inumber,"";Igender,"";Iperson,"";Plemma,"";Ctype,"rel";Number,"numbers";Case,"cases";Gender,"genders";Person,"ter"],
"cp*ctype*lemma{/(ip*inumber*igender*iperson/prepnp*plemma*case)}{/(prepnp*plemma*case/np*number*case*gender*person)}",[Ctype]),0.; (*["CTYPE",SubstVar "ctype"]*)
"lemma=się,pos=qub", Basic "się",0.; (* FIXME: dodać make_np *)
"lemma=nie,pos=qub", Basic "nie",0.;
"lemma=by,pos=qub", Basic "by",0.;
"lemma=niech,pos=qub", Basic "aux-imp",0.;
"lemma=niechaj,pos=qub", Basic "aux-imp",0.;
"lemma=niechże,pos=qub", Basic "aux-imp",0.;
"lemma=niechajże,pos=qub", Basic "aux-imp",0.;
"lemma=czy,pos=qub", Quant([Ctype,"int"],"cp*ctype*lemma/ip*T*T*T"),0.;
"lemma=gdyby,pos=qub", Quant([Ctype,"rel"],"cp*ctype*lemma/ip*T*T*T"),0.;
"pos=qub", Basic "qub",0.;
"pos=interj", Basic "interj",0.;
"lemma=-,pos=interp", Basic "hyphen",0.;
"lemma=?,pos=interp", Basic "int",0.;
"lemma=„,pos=interp", Quot([Number,"";Case,"";Gender,"";Person,""],"(np*number*case*gender*person/rquot)/np*number*case*gender*person"),0.;
"lemma=«,pos=interp", Quot([Number,"";Case,"";Gender,"";Person,""],"(np*number*case*gender*person/rquot2)/np*number*case*gender*person"),0.;
"lemma=»,pos=interp", Quot([Number,"";Case,"";Gender,"";Person,""],"(np*number*case*gender*person/rquot3)/np*number*case*gender*person"),0.;
"lemma=”,pos=interp", Basic "rquot",0.;
"lemma=»,pos=interp", Basic "rquot2",0.;
"lemma=«,pos=interp", Basic "rquot3",0.;
"lemma=(,pos=interp", Inclusion "(inclusion/rparen)/(np*T*T*T*T+ip*T*T*T+adjp*T*T*T+prepnp*T*T)",0.;
"lemma=[,pos=interp", Inclusion "(inclusion/rparen2)/(np*T*T*T*T+ip*T*T*T+adjp*T*T*T+prepnp*T*T)",0.;
"lemma=),pos=interp", Basic "rparen",0.;
"lemma=],pos=interp", Basic "rparen2",0.;
"pos=unk", Basic "np*number*case*gender*person",0.;
(* | ".","interp",[] -> [LCGrenderer.make_frame_simple [] ["dot"] c (make_node "." "interp" c.weight 0 [])] (* FIXME: to jest potrzebne przy CONLL *)
| "<conll_root>","interp",[] ->
let batrs = (make_node "<conll_root>" "interp" c.weight 0 []) in
let schema_list = [[schema_field CLAUSE "Clause" Forward [Phrase IP;Phrase (CP(Int,CompUndef));Phrase (NP(Case "voc"));Phrase (Lex "interj")]]] in
[LCGrenderer.make_frame false tokens lex_sems [] schema_list ["<conll_root>"] d batrs]
| lemma,c,l -> failwith ("process_interp: " ^ lemma ^ ":" ^ c ^ ":" ^ (String.concat ":" (Xlist.map l (String.concat ".")))) in*)
"pos=sinterj", Bracket "interj",0.;
"lemma=</sentence>,pos=interp", Bracket "s\\?(ip*T*T*T+cp*int*T+np*sg*voc*T*T+interj)",0.;
"lemma=<sentence>,pos=interp", Bracket "<root>/s",0.;
"lemma=:,pos=interp", Bracket "or",0.;
"lemma=:s,pos=interp", Bracket "<colon>\\<speaker>",0.;
"lemma=:s,pos=interp", Bracket "(<colon>\\<speaker>)/<squery>",0.;
"lemma=<or-sentence>,pos=interp", Bracket "<root>/s",0.;
"lemma=<or-sentence>,pos=interp", Bracket "((<root>/<speaker-end>)/(ip*T*T*T/or))/or2",0.;
"lemma=</or-sentence>,pos=interp", Bracket "or2\\?(ip*T*T*T+cp*int*T+np*sg*voc*T*T+interj)",0.;
"lemma=<sentence>,pos=interp", Bracket "(<speaker>/<speaker-end>)/np*T*nom*T*T",0.;
"lemma=</sentence>,pos=interp", Bracket "<speaker-end>",0.;
]
let rec split_comma found rev = function
"lemma" :: "=" :: "," :: l -> split_comma found ("," :: "=" :: "lemma" :: rev) l
| "," :: l -> split_comma (List.rev rev :: found) [] l
| s :: l -> split_comma found (s :: rev) l
| [] -> if rev = [] then found else List.rev rev :: found
let match_selectors = function
"lemma" :: l -> Lemma,l
| "pos" :: l -> Pos,l
| "pos2" :: l -> Pos2,l
|
|
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
|
"ppron12",[Lemma,"lemma";Number,"numbers";Case,"cases";Gender,"genders";Person,"persons";];
"ppron3",[Lemma,"lemma";Number,"numbers";Case,"cases";Gender,"genders";Person,"persons";Praep,"praeps";];
"siebie",[Lemma,"lemma";Number,"numbers";Case,"cases";Gender,"genders";Person,"persons";];
"prep",[Lemma,"lemma";Case,"cases";];
"compar",[Lemma,"lemma";Case,"cases";];
"num",[Lemma,"lemma";Number,"numbers";Case,"cases";Gender,"genders";Person,"persons";Acm,"acms";];
"intnum",[Lemma,"lemma";Number,"numbers";Case,"cases";Gender,"genders";Person,"persons";Acm,"acms";];
"realnum",[Lemma,"lemma";Number,"numbers";Case,"cases";Gender,"genders";Person,"persons";Acm,"acms";];
"intnum-interval",[Lemma,"lemma";Number,"numbers";Case,"cases";Gender,"genders";Person,"persons";Acm,"acms";];
"realnum-interval",[Lemma,"lemma";Number,"numbers";Case,"cases";Gender,"genders";Person,"persons";Acm,"acms";];
"symbol",[Lemma,"lemma";Number,"numbers";Case,"cases";Gender,"genders";Person,"persons";];
"ordnum",[Lemma,"lemma";Number,"numbers";Case,"cases";Gender,"genders";Grad,"grads";];
"date",[Lemma,"lemma";Nsyn,"nsyn";Nsem,"nsem";];
"date-interval",[Lemma,"lemma";Nsyn,"nsyn";Nsem,"nsem";];
"hour-minute",[Lemma,"lemma";Nsyn,"nsyn";Nsem,"nsem";];
"hour",[Lemma,"lemma";Nsyn,"nsyn";Nsem,"nsem";];
"hour-minute-interval",[Lemma,"lemma";Nsyn,"nsyn";Nsem,"nsem";];
"hour-interval",[Lemma,"lemma";Nsyn,"nsyn";Nsem,"nsem";];
"year",[Lemma,"lemma";Nsyn,"nsyn";Nsem,"nsem";];
"year-interval",[Lemma,"lemma";Nsyn,"nsyn";Nsem,"nsem";];
"day",[Lemma,"lemma";Nsyn,"nsyn";Nsem,"nsem";];
"day-interval",[Lemma,"lemma";Nsyn,"nsyn";Nsem,"nsem";];
"day-month",[Lemma,"lemma";Nsyn,"nsyn";Nsem,"nsem";];
"day-month-interval",[Lemma,"lemma";Nsyn,"nsyn";Nsem,"nsem";];
"month-interval",[Lemma,"lemma";Nsyn,"nsyn";Nsem,"nsem";];
"roman-ordnum",[Lemma,"lemma";Number,"numbers";Case,"cases";Gender,"genders";Grad,"grads";];
"roman",[Lemma,"lemma";Nsyn,"nsyn";Nsem,"nsem";];
"roman-interval",[Lemma,"lemma";Nsyn,"nsyn";Nsem,"nsem";];
"match-result",[Lemma,"lemma";Nsyn,"nsyn";Nsem,"nsem";];
"url",[Lemma,"lemma";Nsyn,"nsyn";Nsem,"nsem";];
"email",[Lemma,"lemma";Nsyn,"nsyn";Nsem,"nsem";];
"obj-id",[Lemma,"lemma";Nsyn,"nsyn";Nsem,"nsem";];
|