def create_candid_coref(doc): sent_src = doc.sents[:] candid = [] for i in range(len(sent_src) - 1): fs = sent_src[i] fs_entits = fs.events for ts in sent_src[i + 1:]: ts_entits = ts.events for pair in product(fs_entits, ts_entits): if get_phrase_head(pair[0]).lemma == get_phrase_head(pair[1]).lemma: tl = create_tlink_between_enty('dummy_id', pair[0], pair[1]) tl.pred = 'OVERLAP' candid.append(tl) return candid
def to_tense(tl): head = get_phrase_head(tl.to_enty) if head: return _tense(head)
def from_tense(tl): head = get_phrase_head(tl.from_enty) if head: return _tense(head)
def ident_head(tl): fh = get_phrase_head(tl.from_enty) th = get_phrase_head(tl.to_enty) if fh.lemma == th.lemma: return 'true'
def to_head_vb(tl): th = get_phrase_head(tl.to_enty) if th.pos[:2] == 'VB': return th.lemma
def from_head_vb(tl): fh = get_phrase_head(tl.from_enty) if fh.pos[:2] == 'VB': return fh.lemma
def to_vrel_from(tl): fh = get_phrase_head(tl.from_enty) th = get_phrase_head(tl.to_enty) if th.dep_node.head == fh.dep_node and fh.pos[:2] == 'VB': #return 'true' return fh.lemma
def from_vrel_to(tl): fh = get_phrase_head(tl.from_enty) th = get_phrase_head(tl.to_enty) if fh.dep_node.head == th.dep_node and th.pos[:2] == 'VB': #return 'true' return th.lemma
def to_head(tl): head = get_phrase_head(tl.to_enty) return head.lemma
def from_head(tl): head = get_phrase_head(tl.from_enty) return head.lemma
def to_pos(tl): head = get_phrase_head(tl.to_enty) return head.pos
def from_pos(tl): head = get_phrase_head(tl.from_enty) return head.pos