def _argument_resolution(self, events): "Argument resolution." for p in list(events): if p.root.gov_rel == self.ud.xcomp: if not self.options.cut: # Merge the arguments of xcomp to its gov. (Unlike ccomp, an open # clausal complement (xcomp) shares its arguments with its gov.) g = self._get_top_xcomp(p) if g is not None: # Extend the arguments of event's governor args = [arg for arg in p.arguments] g.rules.append(R.l()) g.arguments.extend(args) # copy arg rules of `event` to its gov's rule tracker. for arg in args: arg.rules.append(R.l()) # remove p in favor of it's xcomp governor g. events = [e for e in events if e.position != p.position] for p in sort_by_position(events): # Add an argument to predicate inside relative clause. The # missing argument is rooted at the governor of the `acl` # depedency relation (type acl) pointing here. if (self.options.resolve_relcl and self.options.borrow_arg_for_relcl and p.root.gov_rel.startswith(self.ud.acl)): new = Argument(p.root.gov, self.ud, [R.arg_resolve_relcl()]) p.rules.append(R.pred_resolve_relcl()) p.arguments.append(new) if p.root.gov_rel == self.ud.conj: g = self.event_dict.get(p.root.gov) if g is not None: if not p.has_subj(): if g.has_subj(): # If an event governed by a conjunction is missing a # subject, try borrowing the subject from the other # event. new_arg = g.subj().reference() new_arg.rules.append(R.borrow_subj(new_arg, g)) p.arguments.append(new_arg) else: # Try borrowing the subject from g's xcomp (if any) g_ = self._get_top_xcomp(g) if g_ is not None and g_.has_subj(): new_arg = g_.subj().reference() new_arg.rules.append(R.borrow_subj(new_arg, g_)) p.arguments.append(new_arg) if len(p.arguments) == 0 and g.has_obj(): # If an event governed by a conjunction is missing an # argument, try borrowing the subject from the other # event. new_arg = g.obj().reference() new_arg.rules.append(R.borrow_obj(new_arg, g)) p.arguments.append(new_arg) if p.root.gov_rel == self.ud.advcl and not p.has_subj(): g = self.event_dict.get(p.root.gov) if g is not None and g.has_subj(): new_arg = g.subj().reference() new_arg.rules.append(R.borrow_subj(new_arg, g)) p.arguments.append(new_arg) if p.root.gov_rel == self.ud.conj: g = self.event_dict.get(p.root.gov) if g is not None: # Coordinated appositional modifers share the same subj. if p.root.gov_rel == self.ud.amod: p.arguments.append(Argument(g.root.gov, self.ud, [R.o()])) elif p.root.gov_rel == self.ud.appos: p.arguments.append(Argument(g.root.gov, self.ud, [R.p()])) for p in sort_by_position(events): if p.root.gov_rel == self.ud.xcomp: if self.options.cut: for g in self.parents(p): # Subject of an xcomp is most likely to come from the # object of the governing predicate. if g.has_obj(): # "I like you to finish this work" # ^ ^ ^ # g g.obj p new_arg = g.obj().reference() new_arg.rules.append(R.cut_borrow_obj(new_arg, g)) p.arguments.append(new_arg) break elif g.has_subj(): # "I 'd like to finish this work" # ^ ^ ^ # g.subj g p new_arg = g.subj().reference() new_arg.rules.append(R.cut_borrow_subj(new_arg, g)) p.arguments.append(new_arg) break elif g.root.gov_rel in self.ud.ADJ_LIKE_MODS: # PredPatt recognizes structures which are shown to be accurate . # ^ ^ ^ # g.subj g p new_arg = Argument(g.root.gov, self.ud, [R.cut_borrow_other(g.root.gov, g)]) p.arguments.append(new_arg) break for p in sort_by_position(events): # Note: The following rule improves coverage a lot in Spanish and # Portuguese. Without it, miss a lot of arguments. if (not p.has_subj() and p.type == NORMAL and p.root.gov_rel not in {self.ud.csubj, self.ud.csubjpass} and not p.root.gov_rel.startswith(self.ud.acl) and not p.has_borrowed_arg() ): g = self.event_dict.get(p.root.gov) if g is not None: if g.has_subj(): new_arg = g.subj().reference() new_arg.rules.append(R.borrow_subj(new_arg, g)) p.arguments.append(new_arg) else: # Still no subject. Try looking at xcomp of conjunction root. g = self._get_top_xcomp(p) if g is not None and g.has_subj(): new_arg = g.subj().reference() new_arg.rules.append(R.borrow_subj(new_arg, g)) p.arguments.append(new_arg) return list(events)
def _argument_resolution(self, events): "Argument resolution." """ NB: Elias <*****@*****.**> changed this to exclude prevent, dissuade, and reproach This fix is for object control not working with ditransitive verbs that have a non-infinitival complement, e.g. prevent, dissuade, reproach. For example, ``I_i persuaded him_j [PRO_j to leave]'' is being parsed correctly (PRO indexed with the object, i.e. object control) BUT ``I_i prevented him_j [PRO_j from leaving]'' is being incorrectly parsed as ``I_i prevented him_j [PRO_i from leaving]'' i.e. it is being parsed as subjected control when in fact it is object control. The only verbs where there is ditransitive object control and the proposition is NOT ``to'' that I can think of are ``prevent'' (from), ``disuade'' (from), """ exclude = [ "prevent", "prevents", "prevented", "preventing", "dissuade", "dissuades", "dissuaded", "dissuading", "reproach", "reproaches", "reproached", "reproaching" ] for p in list(events): if p.root.gov_rel == self.ud.xcomp: if not self.options.cut: # Merge the arguments of xcomp to its gov. (Unlike ccomp, an open # clausal complement (xcomp) shares its arguments with its gov.) g = self._get_top_xcomp(p) if g is not None: # Extend the arguments of event's governor args = [arg for arg in p.arguments] g.rules.append(R.l()) g.arguments.extend(args) # copy arg rules of `event` to its gov's rule tracker. for arg in args: arg.rules.append(R.l()) # remove p in favor of it's xcomp governor g. events = [ e for e in events if e.position != p.position ] for p in sort_by_position(events): # Add an argument to predicate inside relative clause. The # missing argument is rooted at the governor of the `acl` # depedency relation (type acl) pointing here. if (self.options.resolve_relcl and self.options.borrow_arg_for_relcl and p.root.gov_rel.startswith(self.ud.acl)): new = Argument(p.root.gov, self.ud, [R.arg_resolve_relcl()]) p.rules.append(R.pred_resolve_relcl()) p.arguments.append(new) if p.root.gov_rel == self.ud.conj: g = self.event_dict.get(p.root.gov) if g is not None: if not p.has_subj(): if g.has_subj(): # If an event governed by a conjunction is missing a # subject, try borrowing the subject from the other # event. new_arg = g.subj().reference() new_arg.rules.append(R.borrow_subj(new_arg, g)) p.arguments.append(new_arg) else: # Try borrowing the subject from g's xcomp (if any) g_ = self._get_top_xcomp(g) if g_ is not None and g_.has_subj(): new_arg = g_.subj().reference() new_arg.rules.append(R.borrow_subj( new_arg, g_)) p.arguments.append(new_arg) if len(p.arguments) == 0 and g.has_obj(): # If an event governed by a conjunction is missing an # argument, try borrowing the subject from the other # event. new_arg = g.obj().reference() new_arg.rules.append(R.borrow_obj(new_arg, g)) p.arguments.append(new_arg) """ NB these are heavily lexicalized exceptions (added by Elias <*****@*****.**>) to deal with object control problems """ from_for = any([ x[2].text in ['from', 'for'] and x[0] == 'mark' for x in p.root.dependents ]) if p.root.gov_rel == self.ud.advcl and not p.has_subj( ) and not from_for: g = self.event_dict.get(p.root.gov) if g is not None and g.has_subj(): new_arg = g.subj().reference() new_arg.rules.append(R.borrow_subj(new_arg, g)) p.arguments.append(new_arg) if p.root.gov_rel == self.ud.conj: g = self.event_dict.get(p.root.gov) if g is not None: # Coordinated appositional modifers share the same subj. if p.root.gov_rel == self.ud.amod: p.arguments.append( Argument(g.root.gov, self.ud, [R.o()])) elif p.root.gov_rel == self.ud.appos: p.arguments.append( Argument(g.root.gov, self.ud, [R.p()])) for p in sort_by_position(events): if p.root.gov_rel == self.ud.xcomp: if self.options.cut: for g in self.parents(p): # Subject of an xcomp is most likely to come from the # object of the governing predicate. if g.has_obj(): # "I like you to finish this work" # ^ ^ ^ # g g.obj p new_arg = g.obj().reference() new_arg.rules.append(R.cut_borrow_obj(new_arg, g)) p.arguments.append(new_arg) break elif g.has_subj(): # "I 'd like to finish this work" # ^ ^ ^ # g.subj g p new_arg = g.subj().reference() new_arg.rules.append(R.cut_borrow_subj(new_arg, g)) p.arguments.append(new_arg) break elif g.root.gov_rel in self.ud.ADJ_LIKE_MODS: # PredPatt recognizes structures which are shown to be accurate . # ^ ^ ^ # g.subj g p new_arg = Argument( g.root.gov, self.ud, [R.cut_borrow_other(g.root.gov, g)]) p.arguments.append(new_arg) break for p in sort_by_position(events): if (p.root.gov_rel == self.ud.advcl and not p.has_subj() and any([ x[2].text in ['from', 'for'] and x[0] == "mark" for x in p.root.dependents ])): g = self.event_dict.get(p.root.gov) # set to the OBJECT not SUBJECT if g is not None and g.has_obj(): new_arg = g.obj().reference() new_arg.rules.append(R.borrow_subj(new_arg, g)) p.arguments.append(new_arg) # Note: The following rule improves coverage a lot in Spanish and # Portuguese. Without it, miss a lot of arguments. if (not p.has_subj() and p.type == NORMAL and p.root.gov_rel not in {self.ud.csubj, self.ud.csubjpass} and not p.root.gov_rel.startswith(self.ud.acl) and not p.has_borrowed_arg() #and p.root.gov.text not in exclude ): g = self.event_dict.get(p.root.gov) if g is not None: if g.has_subj(): new_arg = g.subj().reference() #print("inside 847 if for p = {}".format(p)) new_arg.rules.append(R.borrow_subj(new_arg, g)) p.arguments.append(new_arg) else: # Still no subject. Try looking at xcomp of conjunction root. g = self._get_top_xcomp(p) if g is not None and g.has_subj(): new_arg = g.subj().reference() new_arg.rules.append(R.borrow_subj(new_arg, g)) p.arguments.append(new_arg) return list(events)