in genre/entity_linking.py [0:0]
def get_trie_entity(sent, sent_orig):
pointer_start, pointer_end = get_pointer_mention(sent)
if pointer_start + 1 != pointer_end:
mention = decode_fn(sent[pointer_start + 1 : pointer_end]).strip()
if candidates_trie is not None:
candidates_trie_tmp = candidates_trie
elif mention_to_candidates_dict is not None:
candidates_trie_tmp = Trie(
[
encode_fn(
" {} {} {} {}".format(
end_mention_token,
start_entity_token,
e,
end_entity_token,
)
)[1:]
for e in mention_to_candidates_dict.get(mention, ["NIL"])
]
)
else:
raise RuntimeError()
return candidates_trie_tmp.get(sent[pointer_end:])
return []