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 _subject_preposition(claim): subjects = claim.edges_with_argrole('s') if len(subjects) == 1: subject = strip_concept(subjects[0]) if subject is not None and subject.type() == 'Ci': atom = subject.atom_with_type('C') return atom.root() return None
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': 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 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 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, subjects[0]) if self._is_actor(hg, actor): for claim in claims: self._process_claim(actor, claim, edge)
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)