@@ -36,7 +36,7 @@ def __init__(self, neg=True, **kwargs):
3636
3737 def process_node (self , node ):
3838
39- if node .misc ['Phrase ' ] != '' :
39+ if node .misc ['Peri ' ] != '' :
4040 return
4141
4242 cop = [x for x in node .children if x .udeprel == 'cop' ]
@@ -102,6 +102,7 @@ def process_node(self, node):
102102 gender = node .feats ['Gender' ],
103103 voice = node .feats ['Voice' ],
104104 expl = expl ,
105+ periphrasis = self .get_periphrasis_bool (node ),
105106 ords = [node .ord ]
106107 )
107108 return
@@ -120,7 +121,7 @@ def process_node(self, node):
120121 phrase_ords = [node .ord ] + [r .ord for r in refl ]
121122 phrase_ords .sort ()
122123
123- self .process_phrases_with_ir_aller (node , expl , polarity , phrase_ords , node )
124+ self .process_phrases_with_ir_aller_estar (node , expl , polarity , phrase_ords , node )
124125 self .process_simple_verb_forms (node , expl , polarity , phrase_ords , node )
125126
126127
@@ -151,7 +152,7 @@ def process_node(self, node):
151152 phrase_ords .sort ()
152153
153154 # TODO phrase-level features are currently determined based on the first passive auxiliary, but it can happen that there are more than one passive auxiliary
154- self .process_phrases_with_ir_aller (auxes [0 ], expl , polarity , phrase_ords , node )
155+ self .process_phrases_with_ir_aller_estar (auxes [0 ], expl , polarity , phrase_ords , node )
155156 self .process_simple_verb_forms (auxes [0 ], expl , polarity , phrase_ords , node )
156157
157158 # head verb has passive auxiliary and also other auxiliaries
@@ -229,7 +230,7 @@ def process_modal_verbs(self, modals, modal_auxes, modal_neg):
229230 polarity = 'Neg'
230231 else :
231232 phrase_ords = [modals [0 ].ord ]
232- self .process_phrases_with_ir_aller (modals [0 ], '' , polarity , phrase_ords , modals [0 ])
233+ self .process_phrases_with_ir_aller_estar (modals [0 ], '' , polarity , phrase_ords , modals [0 ])
233234 self .process_simple_verb_forms (modals [0 ], '' , polarity , phrase_ords , modals [0 ])
234235
235236 else :
@@ -244,17 +245,17 @@ def process_modal_verbs(self, modals, modal_auxes, modal_neg):
244245
245246 self .process_periphrastic_verb_forms (modals [0 ], modal_auxes , '' , polarity , phrase_ords , modals [0 ])
246247
247- def process_phrases_with_ir_aller (self , node , expl , polarity , phrase_ords , head_node ):
248+ def process_phrases_with_ir_aller_estar (self , node , expl , polarity , phrase_ords , head_node ):
248249 aspect = ''
249250 tense = node .feats ['Tense' ]
250251
251252 # phrase already annotated
252- if head_node .misc ['Phrase ' ] != '' :
253+ if head_node .misc ['Peri ' ] != '' :
253254 return
254255
255256 xcomps = [x for x in node .children if x .udeprel == 'xcomp' ]
256- if node .lemma in ['ir' , 'aller' , 'estar' ] and node .upos == 'VERB' and xcomps :
257- node .misc ['PhraseAux ' ] = 'Yes'
257+ if node .lemma in ['ir' , 'aller' , 'estar' , 'ter' ] and node .upos == 'VERB' and xcomps :
258+ node .misc ['PeriAux ' ] = 'Yes'
258259
259260 voice = node .feats ['Voice' ]
260261 auxes = [x for x in xcomps [0 ].children if x .udeprel == 'aux' ]
@@ -280,6 +281,11 @@ def process_phrases_with_ir_aller(self, node, expl, polarity, phrase_ords, head_
280281 tense = Tense .FUT .value
281282 aspect = Aspect .PROG .value
282283
284+ elif node .lemma == 'ter' and len (xcomps ) > 1 :
285+ tense = Tense .PAST .value
286+ aspect = Aspect .PROG .value
287+ xcomps [0 ].misc ['PeriAux' ] = 'Yes'
288+
283289 elif node .feats ['Tense' ] == 'Pres' :
284290 tense = Tense .FUT .value
285291
@@ -301,18 +307,20 @@ def process_phrases_with_ir_aller(self, node, expl, polarity, phrase_ords, head_
301307 if auxes [0 ].lemma == 'haber' :
302308 aspect += 'Perf'
303309
304- adp_a = [x for x in xcomps [0 ].children if x .lemma == 'a' and x .udeprel == 'mark' ]
310+
311+
312+ adp_a = [x for x in xcomps [- 1 ].children if x .lemma == 'a' and x .udeprel == 'mark' ]
305313 cop = [x for x in xcomps [0 ].children if x .udeprel == 'cop' ]
306- phrase_ords = [node .ord , xcomps [ 0 ] .ord ] + [x .ord for x in auxes ] + [x .ord for x in cop ]
314+ phrase_ords = [node .ord ] + [ x .ord for x in xcomps ] + [x .ord for x in auxes ] + [x .ord for x in cop ]
307315 if adp_a :
308- phrase_ords . append ( adp_a [ 0 ] .ord )
316+ phrase_ords += [ x .ord for x in adp_a ]
309317
310318 if aux_pass :
311319 voice = 'Pass'
312320
313321 phrase_ords .sort ()
314322
315- self .write_node_info (xcomps [0 ],
323+ self .write_node_info (xcomps [- 1 ],
316324 tense = tense ,
317325 number = node .feats ['Number' ],
318326 person = node .feats ['Person' ],
@@ -322,6 +330,7 @@ def process_phrases_with_ir_aller(self, node, expl, polarity, phrase_ords, head_
322330 voice = voice ,
323331 expl = expl ,
324332 polarity = polarity ,
333+ periphrasis = 'Yes' ,
325334 ords = phrase_ords )
326335 return
327336
@@ -337,7 +346,7 @@ def process_simple_verb_forms(self, node, expl, polarity, phrase_ords, head_node
337346 head_node (udapi.core.node.Node): The node that should receive the Phrase* attributes, i.e., the head of the phrase.
338347 """
339348
340- if node .misc ['PhraseAux ' ] != '' :
349+ if node .misc ['PeriAux ' ] != '' :
341350 return
342351
343352 # Portuguese
@@ -459,6 +468,7 @@ def process_simple_verb_forms(self, node, expl, polarity, phrase_ords, head_node
459468 voice = head_node .feats ['Voice' ],
460469 expl = expl ,
461470 polarity = polarity ,
471+ periphrasis = self .get_periphrasis_bool (head_node ),
462472 ords = phrase_ords
463473 )
464474
@@ -476,7 +486,7 @@ def process_periphrastic_verb_forms(self, node, auxes, expl, polarity, phrase_or
476486 """
477487
478488 # phrase already annotated
479- if head_node .misc ['Phrase ' ] != '' :
489+ if head_node .misc ['Peri ' ] != '' :
480490 return
481491
482492 if len (auxes ) == 1 :
@@ -511,6 +521,7 @@ def process_periphrastic_verb_forms(self, node, auxes, expl, polarity, phrase_or
511521 expl = expl ,
512522 polarity = polarity ,
513523 voice = head_node .feats ['Voice' ],
524+ periphrasis = 'Yes' ,
514525 ords = phrase_ords )
515526 return
516527
@@ -534,6 +545,7 @@ def process_periphrastic_verb_forms(self, node, auxes, expl, polarity, phrase_or
534545 voice = head_node .feats ['Voice' ],
535546 expl = expl ,
536547 polarity = polarity ,
548+ periphrasis = 'Yes' ,
537549 ords = phrase_ords )
538550 return
539551
@@ -558,6 +570,7 @@ def process_periphrastic_verb_forms(self, node, auxes, expl, polarity, phrase_or
558570 voice = head_node .feats ['Voice' ],
559571 expl = expl ,
560572 polarity = polarity ,
573+ periphrasis = 'Yes' ,
561574 ords = phrase_ords )
562575 return
563576
@@ -596,6 +609,7 @@ def process_periphrastic_verb_forms(self, node, auxes, expl, polarity, phrase_or
596609 aspect = aspect ,
597610 expl = expl ,
598611 polarity = polarity ,
612+ periphrasis = 'Yes' ,
599613 ords = phrase_ords )
600614
601615 return
@@ -686,6 +700,7 @@ def process_periphrastic_verb_forms(self, node, auxes, expl, polarity, phrase_or
686700 voice = head_node .feats ['Voice' ],
687701 expl = expl ,
688702 polarity = polarity ,
703+ periphrasis = 'Yes' ,
689704 ords = phrase_ords )
690705 return
691706
@@ -730,6 +745,7 @@ def process_periphrastic_verb_forms(self, node, auxes, expl, polarity, phrase_or
730745 voice = head_node .feats ['Voice' ],
731746 expl = expl ,
732747 polarity = polarity ,
748+ periphrasis = 'Yes' ,
733749 ords = phrase_ords )
734750
735751 return
@@ -748,6 +764,7 @@ def process_periphrastic_verb_forms(self, node, auxes, expl, polarity, phrase_or
748764 voice = head_node .feats ['Voice' ],
749765 expl = expl ,
750766 polarity = polarity ,
767+ periphrasis = 'Yes' ,
751768 ords = phrase_ords )
752769
753770 return
@@ -774,6 +791,7 @@ def process_periphrastic_verb_forms(self, node, auxes, expl, polarity, phrase_or
774791 voice = head_node .feats ['Voice' ],
775792 expl = expl ,
776793 polarity = polarity ,
794+ periphrasis = 'Yes' ,
777795 ords = phrase_ords )
778796
779797 return
@@ -793,6 +811,7 @@ def process_periphrastic_verb_forms(self, node, auxes, expl, polarity, phrase_or
793811 voice = head_node .feats ['Voice' ],
794812 expl = expl ,
795813 polarity = polarity ,
814+ periphrasis = 'Yes' ,
796815 ords = phrase_ords )
797816
798817 return
@@ -810,6 +829,7 @@ def process_periphrastic_verb_forms(self, node, auxes, expl, polarity, phrase_or
810829 voice = head_node .feats ['Voice' ],
811830 expl = expl ,
812831 polarity = polarity ,
832+ periphrasis = 'Yes' ,
813833 ords = phrase_ords )
814834
815835 return
@@ -847,6 +867,7 @@ def process_periphrastic_verb_forms(self, node, auxes, expl, polarity, phrase_or
847867 voice = head_node .feats ['Voice' ],
848868 expl = expl ,
849869 polarity = polarity ,
870+ periphrasis = 'Yes' ,
850871 ords = phrase_ords )
851872
852873 # auxiliriy 'ir' in present or future tense followed by auxiliary 'ter' in infinitive and a participle
@@ -872,6 +893,7 @@ def process_periphrastic_verb_forms(self, node, auxes, expl, polarity, phrase_or
872893 voice = head_node .feats ['Voice' ],
873894 expl = expl ,
874895 polarity = polarity ,
896+ periphrasis = 'Yes' ,
875897 ords = phrase_ords )
876898
877899 # Cnd (only ter/haber), Sub and Past,Pres,Fut tenses: 2 auxes - ter/haber + estar
@@ -910,6 +932,7 @@ def process_periphrastic_verb_forms(self, node, auxes, expl, polarity, phrase_or
910932 voice = head_node .feats ['Voice' ],
911933 expl = expl ,
912934 polarity = polarity ,
935+ periphrasis = 'Yes' ,
913936 ords = phrase_ords ,
914937 )
915938 return
@@ -930,12 +953,12 @@ def process_copulas(self, node, cop, expl, polarity, phrase_ords):
930953 """
931954
932955 # classify the morphological features of the copula node and propagate them to the entire phrase (treating the copula as the content verb)
933- self .process_phrases_with_ir_aller (cop [0 ], expl , polarity , phrase_ords , node )
956+ self .process_phrases_with_ir_aller_estar (cop [0 ], expl , polarity , phrase_ords , node )
934957 self .process_simple_verb_forms (cop [0 ], expl , polarity , phrase_ords , node )
935958
936959 # adjust PhraseAspect based on the lemma of the copula
937960 if cop [0 ].feats ['Tense' ] in ['Pres' , 'Fut' ]:
938961 if cop [0 ].lemma == 'ser' :
939- node .misc ['PhraseAspect ' ] = Aspect .PERF .value
962+ node .misc ['PeriAspect ' ] = Aspect .PERF .value
940963 elif cop [0 ].lemma == 'estar' :
941- node .misc ['PhraseAspect ' ] = Aspect .IMP .value
964+ node .misc ['PeriAspect ' ] = Aspect .IMP .value
0 commit comments