pyabsa.tasks.AspectSentimentTripletExtraction
Subpackages
pyabsa.tasks.AspectSentimentTripletExtraction.configuration
pyabsa.tasks.AspectSentimentTripletExtraction.dataset_utils
pyabsa.tasks.AspectSentimentTripletExtraction.dataset_utils.aste_utils
pyabsa.tasks.AspectSentimentTripletExtraction.dataset_utils.data_utils_for_inference
pyabsa.tasks.AspectSentimentTripletExtraction.dataset_utils.data_utils_for_training
pyabsa.tasks.AspectSentimentTripletExtraction.dataset_utils.dataset_list
pyabsa.tasks.AspectSentimentTripletExtraction.instructor
pyabsa.tasks.AspectSentimentTripletExtraction.models
pyabsa.tasks.AspectSentimentTripletExtraction.prediction
pyabsa.tasks.AspectSentimentTripletExtraction.trainer
Package Contents
Classes
Trainer class for training PyABSA models |
|
Simple object for storing attributes. |
|
Built-in mutable sequence. |
|
The following datasets are for aspect polarity classification task. |
|
- class pyabsa.tasks.AspectSentimentTripletExtraction.ASTETrainer(config: pyabsa.tasks.AspectSentimentTripletExtraction.configuration.configuration.ASTEConfigManager = None, dataset=None, from_checkpoint: str = None, checkpoint_save_mode: int = ModelSaveOption.SAVE_MODEL_STATE_DICT, auto_device: Union[bool, str] = DeviceTypeOption.AUTO, path_to_save=None, load_aug=False)[source]
Bases:
pyabsa.framework.trainer_class.trainer_template.Trainer
Trainer class for training PyABSA models
- class pyabsa.tasks.AspectSentimentTripletExtraction.ASTEConfigManager(args, **kwargs)[source]
Bases:
pyabsa.framework.configuration_class.configuration_template.ConfigManager
Simple object for storing attributes.
Implements equality by attribute names and values, and provides a simple string representation.
- static set_aste_config(configType: str, newitem: dict)
- static set_aste_config_template(newitem)
- static set_aste_config_base(newitem)
- static set_aste_config_english(newitem)
- static set_aste_config_chinese(newitem)
- static set_aste_config_multilingual(newitem)
- static get_aste_config_template()
- static get_aste_config_base()
- static get_aste_config_english()
- static get_aste_config_chinese()
- static get_aste_config_multilingual()
- class pyabsa.tasks.AspectSentimentTripletExtraction.ASTEModelList[source]
Bases:
list
Built-in mutable sequence.
If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.
- EMCGCN
- class pyabsa.tasks.AspectSentimentTripletExtraction.ASTEDatasetList[source]
Bases:
list
The following datasets are for aspect polarity classification task. The datasets are collected from different sources, you can use the id to locate the dataset.
- Laptop14
- Restaurant14
- Restaurant15
- Restaurant16
- SemEval
- Chinese_Zhang
- Multilingual
- class pyabsa.tasks.AspectSentimentTripletExtraction.AspectSentimentTripletExtractor(checkpoint=None, **kwargs)[source]
Bases:
pyabsa.framework.prediction_class.predictor_template.InferenceModel
- task_code
- batch_infer(target_file=None, print_result=True, save_result=False, ignore_error=True, **kwargs)
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)
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)
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)
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.
- _run_prediction(save_path=None, print_result=True, **kwargs)
This method should be implemented in the subclass for running predictions using the trained model.
- Parameters:
kwargs – additional keyword arguments
- Returns:
predicted labels or other prediction outputs
- clear_input_samples()