def process_edge(self, edge, depth): hg = self.system.get_hg(self) if not edge.is_atom(): ct = edge.connector_type() if ct[:2] == 'Pd': pred = edge[0] if (len(edge) > 2 and deep_lemma(hg, pred).root() in CONFLICT_PRED_LEMMAS): subjects = edge.edges_with_argrole('s') objects = edge.edges_with_argrole('o') if len(subjects) == 1 and len(objects) == 1: subject = strip_concept(subjects[0]) obj = strip_concept(objects[0]) if (subject and obj and has_proper_concept(subject) and has_proper_concept(obj)): actor_orig = main_coref(hg, subject) actor_targ = main_coref(hg, obj) conflict_edge = hedge( ('conflict/P/.', actor_orig, actor_targ, edge)) if (is_actor(hg, actor_orig) and is_actor(hg, actor_targ)): yield create_op(conflict_edge) for wedge in self._topics( hg, actor_orig, actor_targ, edge): yield wedge self.conflicts += 1
def input_edge(self, edge): if not edge.is_atom(): ct = edge.connector_type() if ct[:2] == 'pd': pred = edge[0] if (len(edge) > 2 and deep_lemma(self.hg, pred).root() in CLAIM_PRED_LEMMAS): subjects = edge.edges_with_argrole('s') claims = edge.edges_with_argrole('r') if len(subjects) == 1 and len(claims) >= 1: subject = strip_concept(subjects[0]) if subject and has_proper_concept(subject): actor = main_coref(self.hg, subjects[0]) if self._is_actor(actor): for claim in claims: self._process_claim(actor, claim, edge)
def input_edge(self, edge): if not edge.is_atom(): ct = edge.connector_type() if ct[:2] == 'pd': subjects = edge.edges_with_argrole('s') if len(subjects) == 1: subject = strip_concept(subjects[0]) if subject and has_proper_concept(subject): pred = edge[0] dlemma = deep_lemma(self.hg, pred).root() if dlemma in ACTOR_PRED_LEMMAS: try: actor = main_coref(self.hg, subject) self.actor_counter[actor] += 1 except Exception as e: print(str(e))
def process_edge(self, edge, depth): hg = self.system.get_hg(self) if not edge.is_atom(): ct = edge.connector_type() if ct[0] == 'P': subjects = edge.edges_with_argrole('s') if len(subjects) == 1: subject = strip_concept(subjects[0]) if subject and has_proper_concept(subject): pred = edge[0] dlemma = deep_lemma(hg, pred).root() if dlemma in ACTOR_PRED_LEMMAS: try: actor = main_coref(hg, subject) self.actor_counter[actor] += 1 except Exception as e: print(str(e))
def input_edge(self, edge): if not edge.is_atom(): ct = edge.connector_type() if ct[:2] == 'pd': pred = edge[0] if (len(edge) > 2 and deep_lemma(self.hg, pred).root() in CONFLICT_PRED_LEMMAS): subjects = edge.edges_with_argrole('s') objects = edge.edges_with_argrole('o') if len(subjects) == 1 and len(objects) == 1: subject = find_concept(subjects[0]) obj = find_concept(objects[0]) if (subject and obj and is_proper_concept(subject) and is_proper_concept(obj)): actor_orig = main_coref(self.hg, subject) actor_targ = main_coref(self.hg, obj) if (is_actor(self.hg, actor_orig) and is_actor(self.hg, actor_targ)): self.add(('conflict/p/.', actor_orig, actor_targ, edge)) self._topics(actor_orig, actor_targ, edge) self.conflicts += 1
def process_edge(self, edge, depth): hg = self.system.get_hg(self) if not edge.is_atom(): ct = edge.connector_type() if ct[0] == 'P': pred = edge[0] if (len(edge) > 2 and deep_lemma(hg, pred, same_if_none=True).root() in CLAIM_PRED_LEMMAS): subjects = edge.edges_with_argrole('s') claims = edge.edges_with_argrole('r') if len(subjects) == 1 and len(claims) >= 1: subject = strip_concept(subjects[0]) if subject and has_proper_concept(subject): actor = main_coref(hg, subject) self.actors.add(actor) for claim in claims: # if specificatin, claim is inside if claim.type()[0] == 'S': self._process_claim(actor, claim[1], edge) else: self._process_claim(actor, claim, edge)