Skip to content

GLiNER Mentions Extractor

GLiNER is a Named Entity Recognition (NER) model capable of identifying any entity type using a bidirectional transformer encoder (BERT-like). It provides a practical alternative to traditional NER models, which are limited to predefined entities, and Large Language Models (LLMs) that, despite their flexibility, are costly and large for resource-constrained scenarios.

The GLiNER mentions extractor will use the mentions specified in the zshot.PipelineConfig, it just uses the names of the mentions, it doesn't use the descriptions of the mentions.

Bases: MentionsExtractor

GLiNER Mentions Extractor

load_models()

Load GLINER model

predict(docs, batch_size=None)

Perform the entity prediction

Parameters:

Name Type Description Default
docs Iterator[Doc]

A list of spacy Document

required
batch_size Optional[Union[int, None]]

The batch size

None

Returns:

Type Description
List[List[Span]]

List Spans for each Document in docs