Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions coreference/english_coreference/ner_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,13 @@ def _normalize_text(self, text: str, etype: str) -> str:
if etype in {"LOC_ORG", "GROUP"}:
# Remove articles (the) and common company suffixes
for p in ("the ",):
if low.startswith(p):
low = low[len(p) :]
low = low.removeprefix(p)
for suf in (" inc", " ltd", " corp", " corporation", " llc"):
if low.endswith(suf):
low = low[: -len(suf)]
low = low.removesuffix(suf)
return low
if etype == "OBJ":
for art in ("the ", "a ", "an "):
if low.startswith(art):
low = low[len(art) :]
low = low.removeprefix(art)
parts = [p for p in low.replace(".", "").split() if p]
if parts:
return parts[-1]
Expand Down
Loading