langtest.modelhandler.jsl_modelhandler.PretrainedJSLModel#
- class PretrainedJSLModel(model: NLUPipeline | PretrainedPipeline | LightPipeline | PipelineModel)#
Bases:
ABC
PretrainedJSLModel is an abstract class for handling SparkNLP models.
- model#
Loaded SparkNLP LightPipeline for inference.
- Type:
Union[“NLUPipeline”, “PretrainedPipeline”, “LightPipeline”, “PipelineModel”]
- abstract __init__(model: NLUPipeline | PretrainedPipeline | LightPipeline | PipelineModel)#
Constructor method
- Parameters:
model (Union["NLUPipeline", "PretrainedPipeline", "LightPipeline", "PipelineModel"]) – Loaded SparkNLP LightPipeline for inference.
Methods
__init__
(model)Constructor method
load_model
(path)Load the NER model into the model attribute.
predict
(text, *args, **kwargs)Perform predictions with SparkNLP LightPipeline on the input text.
Attributes
hub
- classmethod load_model(path) NLUPipeline #
Load the NER model into the model attribute.
- Parameters:
path (str) – Path to pretrained local or NLP Models Hub SparkNLP model
- abstract predict(text: str, *args, **kwargs) Any #
Perform predictions with SparkNLP LightPipeline on the input text.
- Parameters:
text (str) – Input text to perform translation on.