2
2
import udapi .block .msf .phrase
3
3
from enum import Enum
4
4
5
+ AUXES_HAVE = ['ter' , 'haber' ]
6
+ AUXES_BE = ['estar' ]
7
+
5
8
class Aspect (str , Enum ):
6
9
IMP = 'Imp'
7
10
IMPPROG = 'ImpProg'
@@ -41,7 +44,7 @@ def process_node(self, node):
41
44
self .process_copulas (node ,cop ,auxes ,refl ,expl )
42
45
return
43
46
44
- if node .upos == 'VERB' :
47
+ if node .upos == 'VERB' :#TODO maybe add 'or node.feats['VerbForm'] == 'Part'?
45
48
auxes = [x for x in node .children if x .udeprel == 'aux' ]
46
49
aux_pass = [x for x in node .children if x .deprel == 'aux:pass' ]
47
50
auxes_without_pass = [x for x in node .children if x .udeprel == 'aux' and x .deprel != 'aux:pass' ]
@@ -66,29 +69,48 @@ def process_node(self, node):
66
69
phrase_ords = [node .ord ] + [r .ord for r in refl ]
67
70
phrase_ords .sort ()
68
71
72
+ # Portuguese
69
73
# presente -> PhraseTense=Pres, PhraseAspect=''
70
74
# Futuro do presente -> PhraseTense=Fut, PhraseAspect=''
75
+
76
+ # Spanish
77
+ # presente -> PhraseTense=Pres, PhraseAspect=''
78
+ # futuro simple -> PhraseTense=Fut, PhraseAspect=''
71
79
aspect = ''
72
80
tense = node .feats ['Tense' ]
73
81
74
82
if node .feats ['Mood' ] == 'Ind' :
75
-
83
+
84
+ # Portuguese
76
85
# pretérito imperfeito -> PhraseTense=Past, PhraseAspect=Imp
86
+
87
+ # Spanish
88
+ # pretérito imperfecto -> PhraseTense=Past, PhraseAspect=Imp
77
89
if node .feats ['Tense' ] == 'Imp' :
78
90
tense = Tense .PAST .value
79
91
aspect = Aspect .IMP .value
80
92
93
+ # Portuguese
81
94
# pretérito perfeito -> PhraseTense=Past, PhraseAspect=Perf
95
+
96
+ # Spanish
97
+ # pretérito perfecto -> PhraseTense=Past, PhraseAspect=Perf
82
98
if node .feats ['Tense' ] == 'Past' :
83
99
aspect = Aspect .PERF .value
84
100
101
+ # Portuguese
85
102
# pretérito mais que perfeito simples -> PhraseTense=Past, PhraseAspect=Pqp
86
103
if node .feats ['Tense' ] == 'Pqp' :
87
104
tense = Tense .PAST .value
88
105
aspect = Aspect .PQP .value
89
106
107
+ # Portuguese
90
108
# subjunctive presente -> PhraseTense=Pres, PhraseAspect=''
91
109
# subjunctive futuro -> PhraseTense=Fut, PhraseAspect=''
110
+
111
+ # Spanish
112
+ # subjunctive presente -> PhraseTense=Pres, PhraseAspect=''
113
+ # subjunctive futuro -> PhraseTense=Fut, PhraseAspect='' TODO not annotated in treebanks?
92
114
if node .feats ['Mood' ] == 'Sub' :
93
115
94
116
if node .feats ['Tense' ] == 'Past' :
@@ -99,7 +121,11 @@ def process_node(self, node):
99
121
tense = Tense .PAST .value
100
122
aspect = Aspect .IMP .value
101
123
124
+ # Portuguese
102
125
# Futuro do pretérito (cnd) -> PhraseTense=Pres, PhraseAspect='', PhraseMood=Cnd
126
+
127
+ # Spanish
128
+ # pospretérito (cnd) -> PhraseTense=Pres, PhraseAspect='', PhraseMood=Cnd
103
129
if node .feats ['Mood' ] == 'Cnd' :
104
130
aspect = ''
105
131
tense = Tense .PRES .value
@@ -146,7 +172,6 @@ def process_node(self, node):
146
172
else :
147
173
self .process_periphrastic_verb_forms (aux_pass [0 ], auxes_without_pass , refl , auxes , node )
148
174
149
-
150
175
def process_periphrastic_verb_forms (self , node , auxes , refl , all_auxes , head_node ):
151
176
"""
152
177
Parameters
@@ -166,19 +191,24 @@ def process_periphrastic_verb_forms(self, node, auxes, refl, all_auxes, head_nod
166
191
167
192
if len (auxes ) == 1 :
168
193
# Cnd
169
- if ((auxes [0 ].lemma == 'ter' and node .feats ['VerbForm' ] == 'Part' ) or (auxes [0 ].lemma == 'estar' and node .feats ['VerbForm' ] == 'Ger' )) and auxes [0 ].feats ['Mood' ] == 'Cnd' :
194
+ if ((auxes [0 ].lemma in AUXES_HAVE and node .feats ['VerbForm' ] == 'Part' ) or (auxes [0 ].lemma in AUXES_BE and node .feats ['VerbForm' ] == 'Ger' )) and auxes [0 ].feats ['Mood' ] == 'Cnd' :
170
195
phrase_ords = [head_node .ord ] + [x .ord for x in all_auxes ] + [r .ord for r in refl ] + [r .ord for r in refl ]
171
196
phrase_ords .sort ()
172
197
198
+ # Portuguese
173
199
# aux estar cond + gerund -> PhraseTense=Pres, PhraseAspect=Prog, PhraseMood=Cnd
174
200
if auxes [0 ].lemma == 'estar' :
175
201
tense = Tense .PRES .value
176
202
aspect = Aspect .PROG .value
177
203
178
- # Futuro do pretérito composto -> PhraseTense=Past, PhraseAspect=Perf, PhraseMood=Cnd
204
+ # Portuguese
205
+ # Futuro do pretérito composto -> PhraseTense=Past, PhraseAspect='', PhraseMood=Cnd
206
+
207
+ # Spanish
208
+ # Antepospretérito -> PhraseTense=Past, PhraseAspect='', PhraseMood=Cnd
179
209
else :
180
210
tense = Tense .PAST .value
181
- aspect = Aspect . PERF . value
211
+ aspect = ''
182
212
183
213
self .write_node_info (head_node ,
184
214
tense = tense ,
@@ -193,26 +223,30 @@ def process_periphrastic_verb_forms(self, node, auxes, refl, all_auxes, head_nod
193
223
return
194
224
195
225
# Auxiliary 'estar' followed by a gerund
196
- if auxes [0 ].lemma == 'estar' and node .feats ['VerbForm' ] == 'Ger' :
226
+ if auxes [0 ].lemma in AUXES_BE and node .feats ['VerbForm' ] == 'Ger' :
197
227
phrase_ords = [head_node .ord ] + [x .ord for x in all_auxes ] + [r .ord for r in refl ]
198
228
phrase_ords .sort ()
199
229
230
+ # Portuguese + Spanish
200
231
# pretérito imperfeito (aux estar) -> PhraseTense=Past, PhraseAspect=ImpProg
201
232
# subjunctive pretérito imperfeito (aux estar) -> PhraseTense=Past, PhraseAspect=ImpProg, PhraseMood=Sub
202
233
if auxes [0 ].feats ['Tense' ] == 'Imp' :
203
234
tense = Tense .PAST .value
204
235
aspect = Aspect .IMPPROG .value
205
236
237
+ # Portuguese + Spanish
206
238
# pretérito perfeito (aux estar) -> PhraseTense=Past, PhraseAspect=PerfProg
207
239
elif auxes [0 ].feats ['Tense' ] == 'Past' :
208
240
tense = Tense .PAST .value
209
241
aspect = Aspect .PERFPROG .value
210
242
243
+ # Portuguese + Spanish
211
244
# conditional (aux estar) -> PhraseTense=Pres, PhraseAspect=Prog, PhraseMood=Cnd
212
245
elif auxes [0 ].feats ['Mood' ] == 'Cnd' :
213
246
tense = Tense .PRES .value
214
247
aspect = Aspect .PROG .value
215
248
249
+ # Portuguese + Spanish
216
250
# presente (aux estar) -> PhraseTense=Pres, PhraseAspect=Prog
217
251
# futuro do presente (aux estar) -> PhraseTense=Fut, PhraseAspect=Prog
218
252
# subjunctive presente (aux estar) -> PhraseTense=Pres, PhraseAspect=Prog, PhraseMood=Sub
@@ -232,22 +266,38 @@ def process_periphrastic_verb_forms(self, node, auxes, refl, all_auxes, head_nod
232
266
expl = expl ,
233
267
ords = phrase_ords )
234
268
235
- # Auxiliary 'ter' followed by a participle
236
- if auxes [0 ].lemma == 'ter' and node .feats ['VerbForm' ] == 'Part' :
269
+ # Auxiliary 'ter' / 'haber' followed by a participle
270
+ if auxes [0 ].lemma in AUXES_HAVE and node .feats ['VerbForm' ] == 'Part' :
237
271
phrase_ords = [head_node .ord ] + [x .ord for x in all_auxes ] + [r .ord for r in refl ]
238
272
phrase_ords .sort ()
239
273
274
+ # Portuguese
240
275
# futuro do presente composto (aux ter) -> PhraseTense=Fut, PhraseAspect=Perf
276
+
277
+ # Spanish
278
+ # Futuro compuesto antefuturo -> PhraseTense=Fut, PhraseAspect=Perf
241
279
aspect = Aspect .PERF .value
242
280
tense = auxes [0 ].feats ['Tense' ]
243
281
282
+ # Portuguese
244
283
# pretérito perfeito composto (aux ter) -> PhraseTense=PastPres, PhraseAspect=Perf
245
284
# subjonctive pretérito perfeito composto (aux ter) -> PhraseTense=PastPres, PhraseAspect=Perf, PhraseMood=Sub
285
+
246
286
if auxes [0 ].feats ['Tense' ] == 'Pres' :
247
- tense = Tense .PASTPRES .value
248
287
249
- # pretérito mais que perfeito composto (aux ter/haver) -> PhraseTense=Past, PhraseAspect=Pqp
288
+ # Spanish
289
+ # Pretérito perfecto compuesto ante presente -> PhraseTense=Past, PhraseAspect=Perf
290
+ if auxes [0 ].lemma == 'haber' and auxes [0 ].feats ['Mood' ] != 'Sub' :
291
+ tense = Tense .PAST .value
292
+ else :
293
+ tense = Tense .PASTPRES .value
294
+
295
+ # Portuguese
296
+ # pretérito mais que perfeito composto (aux ter) -> PhraseTense=Past, PhraseAspect=Pqp
250
297
# subjonctive pretérito mais-que-perfeito composto (aux ter) -> PhraseTense=Past, PhraseAspect=Pqp, PhraseMood=Sub
298
+
299
+ # Spanish
300
+ # pretérito pluscuamperfecto -> PhraseTense=Past, PhraseAspect=Pqp
251
301
elif auxes [0 ].feats ['Tense' ] in ['Imp' , 'Past' ]: # TODO prej neni v Past, jenom Imp
252
302
tense = Tense .PAST .value
253
303
aspect = Aspect .PQP .value
@@ -263,6 +313,8 @@ def process_periphrastic_verb_forms(self, node, auxes, refl, all_auxes, head_nod
263
313
expl = expl ,
264
314
ords = phrase_ords )
265
315
316
+ # Portuguese
317
+ # pretérito mais que perfeito composto (aux haver) -> PhraseTense=Past, PhraseAspect=Perf
266
318
if auxes [0 ].lemma == 'haver' and auxes [0 ].feats ['Tense' ] == 'Imp' and node .feats ['VerbForm' ] == 'Part' :
267
319
phrase_ords = [head_node .ord ] + [x .ord for x in all_auxes ] + [r .ord for r in refl ]
268
320
phrase_ords .sort ()
@@ -303,6 +355,7 @@ def process_periphrastic_verb_forms(self, node, auxes, refl, all_auxes, head_nod
303
355
304
356
305
357
# auxiliary 'ir' followed by infinitive
358
+ # TODO solve these verb forms for Spanish (VERB 'ir' + ADP 'a' + infinitive)
306
359
if auxes [0 ].lemma == 'ir' and node .feats ['VerbForm' ] == 'Inf' :
307
360
phrase_ords = [head_node .ord ] + [x .ord for x in all_auxes ] + [r .ord for r in refl ]
308
361
phrase_ords .sort ()
@@ -368,7 +421,11 @@ def process_periphrastic_verb_forms(self, node, auxes, refl, all_auxes, head_nod
368
421
ords = phrase_ords )
369
422
370
423
elif len (auxes ) == 2 :
424
+ # Portuguese
371
425
# auxiliry 'ir' followed by auxiliary 'estar' in infinitive and a gerund
426
+
427
+ # TODO Spanish
428
+ # VERB 'ir' + ADP 'a' + AUX 'estar'.Inf + gerund
372
429
if auxes [0 ].lemma == 'ir' and auxes [1 ].lemma == 'estar' and node .feats ['VerbForm' ] == 'Ger' :
373
430
phrase_ords = [head_node .ord ] + [x .ord for x in all_auxes ] + [r .ord for r in refl ]
374
431
phrase_ords .sort ()
@@ -431,8 +488,8 @@ def process_periphrastic_verb_forms(self, node, auxes, refl, all_auxes, head_nod
431
488
432
489
433
490
434
- # Cnd (only ter), Sub and Past,Pres,Fut tenses: 2 auxes - ter + estar
435
- if auxes [0 ].lemma in [ 'ter' , 'haver' ] and auxes [1 ].lemma == 'estar' and node .feats ['VerbForm' ] == 'Ger' :
491
+ # Cnd (only ter/haber ), Sub and Past,Pres,Fut tenses: 2 auxes - ter/haber + estar
492
+ if auxes [0 ].lemma in AUXES_HAVE and auxes [1 ].lemma == 'estar' and node .feats ['VerbForm' ] == 'Ger' :
436
493
phrase_ords = [head_node .ord ] + [x .ord for x in all_auxes ] + [r .ord for r in refl ]
437
494
phrase_ords .sort ()
438
495
@@ -473,6 +530,8 @@ def process_periphrastic_verb_forms(self, node, auxes, refl, all_auxes, head_nod
473
530
return
474
531
475
532
def process_copulas (self , node , cop , auxes , refl , expl ):
533
+
534
+ aspect = ''
476
535
477
536
if not auxes :
478
537
tense = cop [0 ].feats ['Tense' ]
0 commit comments