pyabsa.tasks.AspectSentimentTripletExtraction.prediction.predictor
Module Contents
Classes
- class pyabsa.tasks.AspectSentimentTripletExtraction.prediction.predictor.AspectSentimentTripletExtractor(checkpoint=None, **kwargs)[source]
Bases:
pyabsa.framework.prediction_class.predictor_template.InferenceModel
- batch_infer(target_file=None, print_result=True, save_result=False, ignore_error=True, **kwargs)[source]
A deprecated version of batch_predict method.
- Parameters:
target_file (str) – the path to the target file for inference
print_result (bool) – whether to print the result
save_result (bool) – whether to save the result
ignore_error (bool) – whether to ignore the error
- Returns:
a dictionary of the results
- Return type:
result (dict)
- infer(text: str = None, print_result=True, ignore_error=True, **kwargs)[source]
A deprecated version of the predict method.
- Parameters:
text (str) – the text to predict
print_result (bool) – whether to print the result
ignore_error (bool) – whether to ignore the error
- Returns:
a dictionary of the results
- Return type:
result (dict)
- batch_predict(target_file=None, print_result=True, save_result=False, ignore_error=True, **kwargs)[source]
Predict the sentiment from a file of sentences. param: target_file: the file path of the sentences to be predicted. param: print_result: whether to print the result. param: save_result: whether to save the result. param: ignore_error: whether to ignore the error when predicting. param: kwargs: other parameters.
- predict(text: Union[str, list] = None, print_result=True, ignore_error=True, **kwargs)[source]
Predict the sentiment from a sentence or a list of sentences. param: text: the sentence to be predicted. param: print_result: whether to print the result. param: ignore_error: whether to ignore the error when predicting. param: kwargs: other parameters.