Skip to content

ReLiK Knowledge Extractor

ReLiK is a lightweight and fast model for Entity Linking and Relation Extraction. It is composed of two main components: a retriever and a reader. The retriever is responsible for retrieving relevant documents from a large collection, while the reader is responsible for extracting entities and relations from the retrieved documents.

In Zshot, we created a Knowledge Extractor to use ReLiK and extract relations directly, without having to specify any entities or relation names.

Bases: KnowledgeExtractor

Instantiate the KnowGL Knowledge Extractor

load_models()

Load relik model

predict(docs, batch_size=None)

Extract triples from docs

Parameters:

Name Type Description Default
docs Iterator[Doc]

Spacy Docs to process

required
batch_size Optional[Union[int, None]]

Batch size for processing

None

Returns:

Type Description
List[List[Tuple[Span, RelationSpan, Span]]]

Triples (subject, relation, object) extracted for each document