Skip to content

Flair Mentions Extractor

Bases: MentionsExtractor

Flair Mentions extractor

  • Requires flair package to be installed *

Parameters:

Name Type Description Default
extractor_type Optional[ExtractorType]

Type of extractor to get mentions. One of: - NER: to use Named Entity Recognition model to get the mentions - POS: to get the mentions based on the linguistics

NER

load_models()

Load Flair model to perform the mentions extraction

predict(docs, batch_size=None)

Predict mentions in each document

Parameters:

Name Type Description Default
docs Iterator[Doc]

Documents to get mentions of

required
batch_size

Batch size to use

None

Returns:

Type Description

Spans of the mentions

predict_ner_mentions(docs, batch_size=None)

Predict mentions of docs using NER model

Parameters:

Name Type Description Default
docs Iterator[Doc]

Documents to get mentions of

required
batch_size Optional[int]

Batch size to use

None

Returns:

Type Description

Spans of the mentions

predict_pos_mentions(docs, batch_size=None)

Predict mentions of docs using POS linguistics

Parameters:

Name Type Description Default
docs Iterator[Doc]

Documents to get mentions of

required
batch_size Optional[int]

Batch size to use

None

Returns:

Type Description

Spans of the mentions