nlptest.modelhandler.spacy_modelhandler.PretrainedModelForNER#

class PretrainedModelForNER(model)#

Bases: _ModelHandler

Parameters:

model – Pretrained SpaCy pipeline.

__init__(model)#

Methods

__init__(model)

load_model(path)

Load and return SpaCy pipeline

predict(text, *args, **kwargs)

Perform predictions on the input text.

predict_raw(text)

Predict a list of labels in form of strings.

classmethod load_model(path)#

Load and return SpaCy pipeline

predict(text: str, *args, **kwargs) NEROutput#

Perform predictions on the input text.

Parameters:
  • text (str) – Input text to perform NER on.

  • kwargs – Additional keyword arguments.

Keyword Arguments:

group_entities (bool) – Option to group entities.

Returns:

A list of named entities recognized in the input text.

Return type:

NEROutput

predict_raw(text: str) List[str]#

Predict a list of labels in form of strings.

Parameters:

text (str) – Input text to perform NER on.

Returns:

A list of named entities recognized in the input text.

Return type:

List[str]