# -*- coding: utf-8 -*-
# file: flag_template.py
# time: 02/11/2022 17:13
# author: YANG, HENG <hy345@exeter.ac.uk> (杨恒)
# github: https://github.com/yangheng95
# GScholar: https://scholar.google.com/citations?user=NPq5a_0AAAAJ&hl=en
# ResearchGate: https://www.researchgate.net/profile/Heng-Yang-17/research
# Copyright (C) 2022. All Rights Reserved.
[docs]class TaskNameOption(dict):
"""
A dictionary subclass that maps task codes to task names.
"""
[docs] code2name = {
"apc": "Aspect-based Sentiment Classification",
"atepc": "Aspect Term Extraction and Polarity Classification",
"aste": "Aspect Sentiment Triple Extraction",
"tc": "Text Classification",
"text_classification": "Text Classification",
"tad": "Text Adversarial Defense",
"rnac": "RNA Sequence Classification",
"rnar": "RNA Sequence Regression",
"APC": "Aspect-based Sentiment Classification",
"ATEPC": "Aspect Term Extraction and Polarity Classification",
"ASTE": "Aspect Sentiment Triple Extraction",
"TC": "Text Classification",
"TAD": "Text Adversarial Defense",
"RNAC": "RNA Sequence Classification",
"RNAR": "RNA Sequence Regression",
"PR": "Protein Sequence Regression",
"CDD": "Code Defect Detection",
}
def __init__(self):
super(TaskNameOption, self).__init__(self.code2name)
[docs] def get(self, key):
"""
Get the task name from the task code.
:param key: The task code.
:return: The task name.
"""
return self.code2name.get(key, "Unknown Task")
[docs]class TaskCodeOption:
"""
A class that defines task codes for various tasks.
"""
[docs] Aspect_Polarity_Classification = "APC"
[docs] Aspect_Term_Extraction_and_Classification = "ATEPC"
[docs] Sentiment_Analysis = "TC"
[docs] Text_Classification = "TC"
[docs] Text_Adversarial_Defense = "TAD"
[docs] RNASequenceClassification = "RNAC"
[docs] RNASequenceRegression = "RNAR"
[docs] ProteinSequenceRegression = "PR"
[docs] CodeDefectDetection = "CDD"
[docs]class LabelPaddingOption:
"""
A class that defines label padding options.
"""
[docs] SENTIMENT_PADDING = -100
[docs]class ModelSaveOption:
"""
A class that defines options for saving models.
"""
[docs] SAVE_MODEL_STATE_DICT = 1
[docs] SAVE_FINE_TUNED_PLM = 3
[docs]class ProxyAddressOption:
"""
A class that defines proxy address options.
"""
[docs] CN_GITHUB_MIRROR = "https://gitee.com/"
[docs]class DeviceTypeOption:
"""
A class that defines device type options.
"""
[docs]PyABSAMaterialHostAddress = "https://huggingface.co/spaces/yangheng/PyABSA/"