Skip to content

TARS Mentions Extractor

When the mentions to be extracted are known by the user they can be specified in order to improve the performance of the system. Based on the TARS linker, the TARS mentions extractor uses the labels of the mentions to give the model information about the mentions to be extracted. TARS doesn't need the descriptions of the entities, so if you can't provide the descriptions of the entities maybe this is the approach you're looking for.

The TARS mentions extractor will use the mentions specified in the zshot.PipelineConfig.

Bases: MentionsExtractor

TARS end2end Linker

Parameters:

Name Type Description Default
default_entities Optional[str]

Default entities to use in case no custom ones are set One of: - 'conll-short' - 'ontonotes-long' - 'ontonotes-short' - 'wnut_17-long' - 'wnut_17-short'

'conll-short'

flat_entities()

As TARS use only the labels, take just the name of the entities and not the description

load_models()

Load TARS model if its not initialized

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

set_kg(mentions)

Set new entities in the model

Parameters:

Name Type Description Default
mentions Iterator[Entity]

New entities to use

required