langtest.modelhandler.spacy_modelhandler.PretrainedModelForTranslation#
- class PretrainedModelForTranslation(model)#
Bases:
ModelAPISpaCy pretrained model for translation tasks
- Parameters:
model – Pretrained SpaCy pipeline.
- __init__(model)#
Constructor method
- Parameters:
model – Pretrained SpaCy pipeline.
Methods
__init__(model)Constructor method
load_model(path)Load and return SpaCy pipeline
predict(text, *args, **kwargs)Perform translation predictions on the input text.
predict_raw(text)Perform translation predictions on input text.
Attributes
model_registry- classmethod load_model(path: str)#
Load and return SpaCy pipeline
- Parameters:
path (str) – name of path to model to load
- predict(text: str, *args, **kwargs) str#
Perform translation predictions on the input text.
- Parameters:
text (str) – Input text to translate.
- Returns:
Translated text.
- Return type:
str
- predict_raw(text: str) str#
Perform translation predictions on input text.
- Parameters:
text (str) – Input text to translate.
- Returns:
Translated text.
- Return type:
str