Relation extraction identifies semantic relationships between entities in unstructured text. Its usual output is a triple: a head entity, a relationship type, and a tail entity. For example, “Google acquired YouTube” becomes Google, ACQUIRED, YouTube. These triples can directly form graph relationships, while values such as dates may sometimes fit better as node properties. section 12.0 section 12.3
It is a step in an information-extraction pipeline that turns text into graph-ready facts. Coreference resolution helps connect references to the same entity, named entity recognition identifies entity spans and types, and entity linking can attach entities to knowledge-base identifiers for later enrichment. section 12.0 section 12.6
Two main approaches extract relations:
- Rule-based extraction applies predefined heuristics, often using part-of-speech tags and dependency parses. A simple rule can connect a verb’s subject and object, but practical rules quickly become more complex. section 12.3
- Deep-learning extraction uses training data to identify relationships. Models may work within one sentence or across a document. section 12.3
- End-to-end extraction detects entities and their relationships in one model, combining work otherwise handled by separate entity and relation stages. section 12.4.3 section 12.6
Extracting company relationships
A practical pipeline can process text about Apple Inc. and return facts such as Apple Inc—founded by→Steve Jobs, Steve Wozniak, and Ronald Wayne. It can also return employer, member-of, and part-of relationships. Results require review: the model may hallucinate relationships that are not stated in the input. section 12.4 section 12.4.3
Listing 12.9 Extracting relationships from text
doc = nlp(ctext) for value, rel_dict in doc._.rel.items(): print(rel_dict)
After loading a SpaCy pipeline with the REBEL component, process the text and iterate over doc._.rel.items() to retrieve extracted relation records. section 12.4.3
For an initial implementation, REBEL can run as a SpaCy component. The pipeline processes text once, then exposes relation records containing a relation label plus head and tail spans. Its output is useful for constructing a graph, but domain fit matters because named entity recognition and relation extraction depend heavily on the use case. section 12.4.3 section 12.6


