pyabsa.tasks.AspectPolarityClassification
Subpackages
pyabsa.tasks.AspectPolarityClassification.configuration
pyabsa.tasks.AspectPolarityClassification.dataset_utils
pyabsa.tasks.AspectPolarityClassification.dataset_utils.__classic__
pyabsa.tasks.AspectPolarityClassification.dataset_utils.__classic__.classic_glove_apc_utils
pyabsa.tasks.AspectPolarityClassification.dataset_utils.__classic__.data_utils_for_inference
pyabsa.tasks.AspectPolarityClassification.dataset_utils.__classic__.data_utils_for_training
pyabsa.tasks.AspectPolarityClassification.dataset_utils.__classic__.dependency_graph
pyabsa.tasks.AspectPolarityClassification.dataset_utils.__lcf__
pyabsa.tasks.AspectPolarityClassification.dataset_utils.__lcf__.apc_utils
pyabsa.tasks.AspectPolarityClassification.dataset_utils.__lcf__.apc_utils_for_dlcf_dca
pyabsa.tasks.AspectPolarityClassification.dataset_utils.__lcf__.data_utils_for_inference
pyabsa.tasks.AspectPolarityClassification.dataset_utils.__lcf__.data_utils_for_training
pyabsa.tasks.AspectPolarityClassification.dataset_utils.__plm__
pyabsa.tasks.AspectPolarityClassification.dataset_utils.__plm__.classic_bert_apc_utils
pyabsa.tasks.AspectPolarityClassification.dataset_utils.__plm__.data_utils_for_inference
pyabsa.tasks.AspectPolarityClassification.dataset_utils.__plm__.data_utils_for_training
pyabsa.tasks.AspectPolarityClassification.dataset_utils.__plm__.dependency_graph
pyabsa.tasks.AspectPolarityClassification.dataset_utils.dataset_list
pyabsa.tasks.AspectPolarityClassification.instructor
pyabsa.tasks.AspectPolarityClassification.models
pyabsa.tasks.AspectPolarityClassification.models.__classic__
pyabsa.tasks.AspectPolarityClassification.models.__classic__.aoa
pyabsa.tasks.AspectPolarityClassification.models.__classic__.asgcn
pyabsa.tasks.AspectPolarityClassification.models.__classic__.atae_lstm
pyabsa.tasks.AspectPolarityClassification.models.__classic__.cabasc
pyabsa.tasks.AspectPolarityClassification.models.__classic__.ian
pyabsa.tasks.AspectPolarityClassification.models.__classic__.lstm
pyabsa.tasks.AspectPolarityClassification.models.__classic__.memnet
pyabsa.tasks.AspectPolarityClassification.models.__classic__.mgan
pyabsa.tasks.AspectPolarityClassification.models.__classic__.ram
pyabsa.tasks.AspectPolarityClassification.models.__classic__.tc_lstm
pyabsa.tasks.AspectPolarityClassification.models.__classic__.td_lstm
pyabsa.tasks.AspectPolarityClassification.models.__classic__.tnet_lf
pyabsa.tasks.AspectPolarityClassification.models.__lcf__
pyabsa.tasks.AspectPolarityClassification.models.__lcf__.bert_base
pyabsa.tasks.AspectPolarityClassification.models.__lcf__.bert_spc
pyabsa.tasks.AspectPolarityClassification.models.__lcf__.bert_spc_v2
pyabsa.tasks.AspectPolarityClassification.models.__lcf__.dlcf_dca_bert
pyabsa.tasks.AspectPolarityClassification.models.__lcf__.dlcfs_dca_bert
pyabsa.tasks.AspectPolarityClassification.models.__lcf__.fast_lcf_bert
pyabsa.tasks.AspectPolarityClassification.models.__lcf__.fast_lcf_bert_att
pyabsa.tasks.AspectPolarityClassification.models.__lcf__.fast_lcfs_bert
pyabsa.tasks.AspectPolarityClassification.models.__lcf__.fast_lsa_s
pyabsa.tasks.AspectPolarityClassification.models.__lcf__.fast_lsa_s_v2
pyabsa.tasks.AspectPolarityClassification.models.__lcf__.fast_lsa_t
pyabsa.tasks.AspectPolarityClassification.models.__lcf__.fast_lsa_t_v2
pyabsa.tasks.AspectPolarityClassification.models.__lcf__.lca_bert
pyabsa.tasks.AspectPolarityClassification.models.__lcf__.lcf_bert
pyabsa.tasks.AspectPolarityClassification.models.__lcf__.lcf_dual_bert
pyabsa.tasks.AspectPolarityClassification.models.__lcf__.lcf_template_apc
pyabsa.tasks.AspectPolarityClassification.models.__lcf__.lcfs_bert
pyabsa.tasks.AspectPolarityClassification.models.__lcf__.lcfs_dual_bert
pyabsa.tasks.AspectPolarityClassification.models.__lcf__.lsa_s
pyabsa.tasks.AspectPolarityClassification.models.__lcf__.lsa_t
pyabsa.tasks.AspectPolarityClassification.models.__lcf__.ssw_s
pyabsa.tasks.AspectPolarityClassification.models.__lcf__.ssw_t
pyabsa.tasks.AspectPolarityClassification.models.__plm__
pyabsa.tasks.AspectPolarityClassification.models.__plm__.aoa_bert
pyabsa.tasks.AspectPolarityClassification.models.__plm__.asgcn_bert
pyabsa.tasks.AspectPolarityClassification.models.__plm__.atae_lstm_bert
pyabsa.tasks.AspectPolarityClassification.models.__plm__.cabasc_bert
pyabsa.tasks.AspectPolarityClassification.models.__plm__.ian_bert
pyabsa.tasks.AspectPolarityClassification.models.__plm__.lstm_bert
pyabsa.tasks.AspectPolarityClassification.models.__plm__.memnet_bert
pyabsa.tasks.AspectPolarityClassification.models.__plm__.mgan_bert
pyabsa.tasks.AspectPolarityClassification.models.__plm__.ram_bert
pyabsa.tasks.AspectPolarityClassification.models.__plm__.tc_lstm_bert
pyabsa.tasks.AspectPolarityClassification.models.__plm__.td_lstm_bert
pyabsa.tasks.AspectPolarityClassification.models.__plm__.tnet_lf_bert
pyabsa.tasks.AspectPolarityClassification.prediction
pyabsa.tasks.AspectPolarityClassification.trainer
Package Contents
Classes
Trainer class for training PyABSA models |
|
Simple object for storing attributes. |
|
Built-in mutable sequence. |
|
Built-in mutable sequence. |
|
Built-in mutable sequence. |
|
Built-in mutable sequence. |
|
Built-in mutable sequence. |
|
Built-in mutable sequence. |
|
The following datasets are for aspect polarity classification task. |
|
- class pyabsa.tasks.AspectPolarityClassification.APCTrainer(config: pyabsa.tasks.AspectPolarityClassification.configuration.apc_configuration.APCConfigManager = 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.AspectPolarityClassification.APCConfigManager(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.
- class pyabsa.tasks.AspectPolarityClassification.APCModelList[source]
Bases:
LCFAPCModelList
Built-in mutable sequence.
If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.
- class pyabsa.tasks.AspectPolarityClassification.BERTBaselineAPCModelList[source]
Bases:
PLMAPCModelList
Built-in mutable sequence.
If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.
- class pyabsa.tasks.AspectPolarityClassification.GloVeAPCModelList[source]
Bases:
ClassicAPCModelList
Built-in mutable sequence.
If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.
- class pyabsa.tasks.AspectPolarityClassification.LCFAPCModelList[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.
- SLIDE_LCF_BERT
- SLIDE_LCFS_BERT
- LSA_T
- LSA_S
- FAST_LSA_T
- FAST_LSA_S
- FAST_LSA_T_V2
- FAST_LSA_S_V2
- DLCF_DCA_BERT
- DLCFS_DCA_BERT
- LCF_BERT
- FAST_LCF_BERT
- LCF_DUAL_BERT
- LCFS_BERT
- FAST_LCFS_BERT
- LCFS_DUAL_BERT
- LCA_BERT
- BERT_MLP
- BERT_SPC
- BERT_SPC_V2
- FAST_LCF_BERT_ATT
- LCF_TEMPLATE_BERT
- class pyabsa.tasks.AspectPolarityClassification.PLMAPCModelList[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.
- AOA_BERT
- ASGCN_BERT
- ATAE_LSTM_BERT
- Cabasc_BERT
- IAN_BERT
- LSTM_BERT
- MemNet_BERT
- MGAN_BERT
- RAM_BERT
- TC_LSTM_BERT
- TD_LSTM_BERT
- TNet_LF_BERT
- class pyabsa.tasks.AspectPolarityClassification.ClassicAPCModelList[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.
- AOA
- ASGCN
- ATAE_LSTM
- Cabasc
- IAN
- LSTM
- MemNet
- MGAN
- RAM
- TC_LSTM
- TD_LSTM
- TNet_LF
- class pyabsa.tasks.AspectPolarityClassification.APCDatasetList[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
- ARTS_Laptop14
- ARTS_Restaurant14
- Restaurant15
- Restaurant16
- ACL_Twitter
- MAMS
- Television
- TShirt
- Yelp
- Phone
- Car
- Notebook
- Camera
- Shampoo
- MOOC
- MOOC_En
- Kaggle
- Chinese_Zhang
- Chinese
- Binary_Polarity_Chinese
- Triple_Polarity_Chinese
- SemEval2016Task5
- Arabic_SemEval2016Task5
- Dutch_SemEval2016Task5
- Spanish_SemEval2016Task5
- Turkish_SemEval2016Task5
- Russian_SemEval2016Task5
- French_SemEval2016Task5
- English_SemEval2016Task5
- English
- SemEval
- Restaurant
- Multilingual
- class pyabsa.tasks.AspectPolarityClassification.SentimentClassifier(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)[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.
- class pyabsa.tasks.AspectPolarityClassification.Predictor(checkpoint=None, **kwargs)[source]
Bases:
SentimentClassifier