Skip to content

Commit 78dfb79

Browse files
Improve copula processing
1 parent 2e10a33 commit 78dfb79

File tree

1 file changed

+23
-48
lines changed

1 file changed

+23
-48
lines changed

udapi/block/msf/romance/romance.py

Lines changed: 23 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def process_node(self, node):
4848
self.process_periphrastic_verb_forms(cop[0], auxes, refl, auxes + cop, node)
4949
else:
5050
# no auxiliaries, only cop
51-
self.process_copulas(node,cop,auxes,refl,expl)
51+
self.process_copulas(node,cop,refl,expl)
5252
return
5353

5454
if node.upos == 'VERB': #TODO maybe add "or node.feats['VerbForm'] == 'Part'"?
@@ -626,54 +626,29 @@ def process_periphrastic_verb_forms(self, node, auxes, refl, all_auxes, head_nod
626626
)
627627
return
628628

629-
def process_copulas(self, node, cop, auxes, refl, expl):
630-
631-
aspect = ''
632-
633-
if not auxes:
634-
tense = cop[0].feats['Tense']
635-
number=cop[0].feats['Number']
636-
person=cop[0].feats['Person']
637-
mood=cop[0].feats['Mood']
638-
639-
if cop[0].feats['Tense'] in ['Pres', 'Fut']:
640-
if cop[0].lemma == 'ser':
641-
aspect=Aspect.PERF.value
642-
elif cop[0].lemma == 'estar':
643-
aspect=Aspect.IMP.value
644-
645-
elif cop[0].feats['Tense'] == 'Imp':
646-
tense=Tense.PAST.value
647-
aspect=Aspect.IMP.value
648-
649-
elif cop[0].feats['Tense'] == 'Past':
650-
aspect=Aspect.PERF.value
651-
else:
652-
# i.e. copulas in infinitive
653-
aspect=''
629+
def process_copulas(self, node, cop, refl, expl):
630+
"""
631+
Annotate non-verbal predicates with copula using the Phrase* attributes.
654632
655-
else:
656-
tense = auxes[0].feats['Tense']
657-
number=auxes[0].feats['Number']
658-
person=auxes[0].feats['Person']
659-
mood=auxes[0].feats['Mood']
660-
aspect=''
633+
This method is specialized for non-periphrastic copulas.
634+
If any auxiliaries are present, process_periphrastic_verb_forms() is called instead.
661635
662-
663-
if auxes[0].lemma == 'estar':
664-
aspect=Aspect.IMPPROG.value
636+
Parameters
637+
node (udapi.core.node.Node): The non-verbal predicate that should receive the Phrase* attributes, i.e., the head of the phrase.
638+
cop (list[udapi.core.node.Node]): The copula nodes.
639+
refl (list[udapi.core.node.Node]): Reflexives that should be included in the periphrastic phrase.
640+
expl (str): The value of the PhraseExpl attribute.
641+
"""
665642

666-
phrase_ords = [node.ord] + [x.ord for x in cop] + [x.ord for x in auxes] + [r.ord for r in refl]
643+
phrase_ords = [node.ord] + [x.ord for x in cop] + [r.ord for r in refl]
667644
phrase_ords.sort()
668-
669-
self.write_node_info(node,
670-
tense=tense,
671-
number=number,
672-
person=person,
673-
mood=mood,
674-
form='Fin',
675-
aspect=aspect,
676-
voice=node.feats['Voice'],
677-
expl=expl,
678-
ords=phrase_ords,
679-
)
645+
646+
# classify the morphological features of the copula node and propagate them to the entire phrase (treating the copula as the content verb)
647+
self.process_simple_verb_forms(cop[0], expl, phrase_ords, node)
648+
649+
# adjust PhraseAspect based on the lemma of the copula
650+
if cop[0].feats['Tense'] in ['Pres', 'Fut']:
651+
if cop[0].lemma == 'ser':
652+
node.misc['PhraseAspect'] = Aspect.PERF.value
653+
elif cop[0].lemma == 'estar':
654+
node.misc['PhraseAspect'] = Aspect.IMP.value

0 commit comments

Comments
 (0)