Skip to content

Commit 203df64

Browse files
Remove lemmas from some rules
1 parent 4694a5b commit 203df64

File tree

1 file changed

+74
-76
lines changed

1 file changed

+74
-76
lines changed

udapi/block/msf/romance/romance.py

Lines changed: 74 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def process_periphrastic_verb_forms(self, node, auxes, refl, all_auxes, head_nod
191191

192192
if len(auxes) == 1:
193193
# 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':
194+
if auxes[0].feats['Mood'] == 'Cnd' and (node.feats['VerbForm'] == 'Part' or node.feats['VerbForm'] == 'Ger'):
195195
phrase_ords = [head_node.ord] + [x.ord for x in all_auxes] + [r.ord for r in refl] + [r.ord for r in refl]
196196
phrase_ords.sort()
197197

@@ -221,9 +221,76 @@ def process_periphrastic_verb_forms(self, node, auxes, refl, all_auxes, head_nod
221221
voice=head_node.feats['Voice'],
222222
ords=phrase_ords)
223223
return
224+
225+
if auxes[0].lemma == 'vir' and auxes[0].feats['Tense'] in ['Pres', 'Imp', 'Past'] and node.feats['VerbForm'] == 'Ger':
226+
phrase_ords = [head_node.ord] + [x.ord for x in all_auxes] + [r.ord for r in refl]
227+
phrase_ords.sort()
228+
229+
# aux Pres (vir) + gerund -> PhraseTense=PastPres, PraseAspect=Prog
230+
if auxes[0].feats['Tense'] == 'Pres':
231+
tense=Tense.PASTPRES.value
232+
233+
234+
elif auxes[0].feats['Tense'] in ['Imp', 'Past']:
235+
tense=Tense.PAST.value
236+
237+
self.write_node_info(head_node,
238+
tense=tense,
239+
number=auxes[0].feats['Number'],
240+
person=auxes[0].feats['Person'],
241+
mood=auxes[0].feats['Mood'],
242+
form='Fin',
243+
aspect=Aspect.PROG.value,
244+
voice=head_node.feats['Voice'],
245+
expl=expl,
246+
ords=phrase_ords)
247+
return
248+
249+
if auxes[0].lemma == 'ir' and node.feats['VerbForm'] == 'Ger':
250+
phrase_ords = [head_node.ord] + [x.ord for x in all_auxes] + [r.ord for r in refl]
251+
phrase_ords.sort()
252+
253+
# aux Pres (ir) + gerund -> PhraseTense=Pres, PhraseAspect=Prog
254+
tense = auxes[0].feats['Tense']
255+
aspect = Aspect.PROG.value
256+
257+
# aux Imp (ir) + gerund -> PhraseTense=Past, PhraseAspect=Prog
258+
if auxes[0].feats['Tense'] == 'Imp':
259+
tense=Tense.PAST.value
260+
aspect=Aspect.PROG.value
261+
262+
self.write_node_info(head_node,
263+
tense=tense,
264+
number=auxes[0].feats['Number'],
265+
person=auxes[0].feats['Person'],
266+
mood=auxes[0].feats['Mood'],
267+
aspect=aspect,
268+
form='Fin',
269+
voice=head_node.feats['Voice'],
270+
expl=expl,
271+
ords=phrase_ords)
272+
return
273+
274+
# Portuguese
275+
# pretérito mais que perfeito composto (aux haver) -> PhraseTense=Past, PhraseAspect=Perf
276+
if auxes[0].lemma == 'haver' and auxes[0].feats['Tense'] == 'Imp' and node.feats['VerbForm'] == 'Part':
277+
phrase_ords = [head_node.ord] + [x.ord for x in all_auxes] + [r.ord for r in refl]
278+
phrase_ords.sort()
279+
280+
self.write_node_info(head_node,
281+
tense=Tense.PAST.value,
282+
aspect=Aspect.PERF.value,
283+
number=auxes[0].feats['Number'],
284+
person=auxes[0].feats['Person'],
285+
mood=auxes[0].feats['Mood'],
286+
form='Fin',
287+
voice=head_node.feats['Voice'],
288+
expl=expl,
289+
ords=phrase_ords)
290+
return
224291

225292
# Auxiliary 'estar' followed by a gerund
226-
if auxes[0].lemma in AUXES_BE and node.feats['VerbForm'] == 'Ger':
293+
if node.feats['VerbForm'] == 'Ger':
227294
phrase_ords = [head_node.ord] + [x.ord for x in all_auxes] + [r.ord for r in refl]
228295
phrase_ords.sort()
229296

@@ -240,12 +307,6 @@ def process_periphrastic_verb_forms(self, node, auxes, refl, all_auxes, head_nod
240307
tense=Tense.PAST.value
241308
aspect=Aspect.PERFPROG.value
242309

243-
# Portuguese + Spanish
244-
# conditional (aux estar) -> PhraseTense=Pres, PhraseAspect=Prog, PhraseMood=Cnd
245-
elif auxes[0].feats['Mood'] == 'Cnd':
246-
tense=Tense.PRES.value
247-
aspect=Aspect.PROG.value
248-
249310
# Portuguese + Spanish
250311
# presente (aux estar) -> PhraseTense=Pres, PhraseAspect=Prog
251312
# futuro do presente (aux estar) -> PhraseTense=Fut, PhraseAspect=Prog
@@ -265,9 +326,11 @@ def process_periphrastic_verb_forms(self, node, auxes, refl, all_auxes, head_nod
265326
aspect=aspect,
266327
expl=expl,
267328
ords=phrase_ords)
329+
330+
return
268331

269332
# Auxiliary 'ter' / 'haber' followed by a participle
270-
if auxes[0].lemma in AUXES_HAVE and node.feats['VerbForm'] == 'Part':
333+
if node.feats['VerbForm'] == 'Part':
271334
phrase_ords = [head_node.ord] + [x.ord for x in all_auxes] + [r.ord for r in refl]
272335
phrase_ords.sort()
273336

@@ -312,48 +375,8 @@ def process_periphrastic_verb_forms(self, node, auxes, refl, all_auxes, head_nod
312375
voice=head_node.feats['Voice'],
313376
expl=expl,
314377
ords=phrase_ords)
378+
return
315379

316-
# Portuguese
317-
# pretérito mais que perfeito composto (aux haver) -> PhraseTense=Past, PhraseAspect=Perf
318-
if auxes[0].lemma == 'haver' and auxes[0].feats['Tense'] == 'Imp' and node.feats['VerbForm'] == 'Part':
319-
phrase_ords = [head_node.ord] + [x.ord for x in all_auxes] + [r.ord for r in refl]
320-
phrase_ords.sort()
321-
322-
self.write_node_info(head_node,
323-
tense=Tense.PAST.value,
324-
aspect=Aspect.PERF.value,
325-
number=auxes[0].feats['Number'],
326-
person=auxes[0].feats['Person'],
327-
mood=auxes[0].feats['Mood'],
328-
form='Fin',
329-
voice=head_node.feats['Voice'],
330-
expl=expl,
331-
ords=phrase_ords)
332-
333-
if auxes[0].lemma == 'vir' and auxes[0].feats['Tense'] in ['Pres', 'Imp', 'Past'] and node.feats['VerbForm'] == 'Ger':
334-
phrase_ords = [head_node.ord] + [x.ord for x in all_auxes] + [r.ord for r in refl]
335-
phrase_ords.sort()
336-
337-
# aux Pres (vir) + gerund -> PhraseTense=PastPres, PraseAspect=Prog
338-
if auxes[0].feats['Tense'] == 'Pres':
339-
tense=Tense.PASTPRES.value
340-
341-
342-
elif auxes[0].feats['Tense'] in ['Imp', 'Past']:
343-
tense=Tense.PAST.value
344-
345-
self.write_node_info(head_node,
346-
tense=tense,
347-
number=auxes[0].feats['Number'],
348-
person=auxes[0].feats['Person'],
349-
mood=auxes[0].feats['Mood'],
350-
form='Fin',
351-
aspect=Aspect.PROG.value,
352-
voice=head_node.feats['Voice'],
353-
expl=expl,
354-
ords=phrase_ords)
355-
356-
357380
# auxiliary 'ir' followed by infinitive
358381
# TODO solve these verb forms for Spanish (VERB 'ir' + ADP 'a' + infinitive)
359382
if auxes[0].lemma == 'ir' and node.feats['VerbForm'] == 'Inf':
@@ -381,9 +404,7 @@ def process_periphrastic_verb_forms(self, node, auxes, refl, all_auxes, head_nod
381404
# Futuro perifrástico passado perf -> PhraseTense=PastFut, PhraseAspect=Perf
382405
elif auxes[0].feats['Tense'] == 'Past':
383406
tense=Tense.PASTFUT.value
384-
aspect=Aspect.PERF.value
385-
386-
407+
aspect=Aspect.PERF.value
387408

388409
self.write_node_info(head_node,
389410
tense=tense,
@@ -396,29 +417,6 @@ def process_periphrastic_verb_forms(self, node, auxes, refl, all_auxes, head_nod
396417
expl=expl,
397418
ords=phrase_ords)
398419

399-
if auxes[0].lemma == 'ir' and node.feats['VerbForm'] == 'Ger':
400-
phrase_ords = [head_node.ord] + [x.ord for x in all_auxes] + [r.ord for r in refl]
401-
phrase_ords.sort()
402-
403-
# aux Pres (ir) + gerund -> PhraseTense=Pres, PhraseAspect=Prog
404-
tense = auxes[0].feats['Tense']
405-
aspect = Aspect.PROG.value
406-
407-
# aux Imp (ir) + gerund -> PhraseTense=Past, PhraseAspect=Prog
408-
if auxes[0].feats['Tense'] == 'Imp':
409-
tense=Tense.PAST.value
410-
aspect=Aspect.PROG.value
411-
412-
self.write_node_info(head_node,
413-
tense=tense,
414-
number=auxes[0].feats['Number'],
415-
person=auxes[0].feats['Person'],
416-
mood=auxes[0].feats['Mood'],
417-
aspect=aspect,
418-
form='Fin',
419-
voice=head_node.feats['Voice'],
420-
expl=expl,
421-
ords=phrase_ords)
422420

423421
elif len(auxes) == 2:
424422
# Portuguese

0 commit comments

Comments
 (0)