Skip to content

Commit

Permalink
better coreference linking rule
Browse files Browse the repository at this point in the history
  • Loading branch information
Aethor committed Sep 16, 2024
1 parent 7fb25c7 commit fcadcb2
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions renard/pipeline/character_unification.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,13 +365,18 @@ def names_are_related_after_title_removal(
or self.hypocorism_gazetteer.are_related(raw_name1, raw_name2)
)

def names_are_in_coref(self, name1: str, name2: str, corefs: List[List[Mention]]):
def names_are_in_coref(
self, name1: str, name2: str, corefs: List[List[Mention]]
) -> bool:
once_together = False
for coref_chain in corefs:
if any([name1 == " ".join(m.tokens) for m in coref_chain]) and any(
[name2 == " ".join(m.tokens) for m in coref_chain]
):
return True
return False
name1_in = any([name1 == " ".join(m.tokens) for m in coref_chain])
name2_in = any([name2 == " ".join(m.tokens) for m in coref_chain])
if name1_in == (not name2_in):
return False
elif name1_in and name2_in:
once_together = True
return once_together

def infer_name_gender(
self,
Expand Down

0 comments on commit fcadcb2

Please sign in to comment.