Coreference resolution identifies expressions that refer to the same entity and links those expressions together. It serves as an early step in information extraction, helping later systems extract relationships from unstructured text. section 12.1 section 12.6
Coreference systems resolve several kinds of references:
- Pronouns and names, such as “Google” and “they,” when both refer to the same entity. section 12.1
- Ambiguous descriptions, such as “the company,” which may require contextual knowledge to distinguish Google from YouTube. section 12.1
- Plural references, such as “both companies,” which may resolve to multiple entities. section 12.1
- Rule-based approaches use syntactic, semantic, and contextual heuristics; neural approaches learn patterns from data instead. section 12.1
Resolving references in an Apple narrative
Given a passage about Apple Inc., Steve Jobs, Steve Wozniak, and Ronald Wayne, a model can replace “They” with the founders and “the company” with Apple Inc. The result can still be wrong: it may assign “his” in “Jobs sold his Volkswagen Bus” to Ronald Wayne, mishandle possessives and articles, or choose AlgoTrim instead of Apple Inc. as the company that acquired Semetric. section 12.4 section 12.4.2
Listing 12.6 Using the coreference model to resolve text references
def coref_text(text):
coref_doc = coref_nlp(text)
resolved_text = ""
for token in coref_doc:
repres = coref_doc._.coref_chains.resolve(token)
if repres:
resolved_text += " " + " and ".join(
[
t.text
if t.ent_type_ == ""
else [e.text for e in coref_doc.ents if t in e][0]
for t in repres
]
)
else:
resolved_text += " " + token.text
return resolved_text
ctext = coref_text(text)
print(ctext)
Inspect the Python function that runs the SpaCy coreference model, resolves each token, substitutes named entities, and builds resolved text. section 12.4.2


