DialogZoo / src /ABSA.py
AnAutomaticPencil's picture
data preprocessing update
a6326c7
import sys
sys.path.append("modules/preprocess")
from preprocessor.SerialPreprocessor import SerialConfig, SerialPreprocessor
from const import (
ABSA_TERM_CATEGORY_SENTIMENT, ABSA_TERM_OPINION_SENTIMENT, ABSA_CATEGORY_SENTIMENT, ABSA_TERM_SENTIMENT
)
from preprocessor.prompt_funcs import const_prompt_func_wrapper
from preprocessor.knowledge_funcs import (
None_knowledge,
)
from preprocessor.label_funs import (
extract_aspects_wrapper,
)
import sys
if __name__ == "__main__":
TASK = ABSA_TERM_SENTIMENT
input_data_path = sys.argv[1]
output_data_path = sys.argv[2]
serial_proc = SerialPreprocessor(
SerialConfig(
input_data_path,
output_data_path,
TASK,
logger_name=TASK,
task_bos_token=f"[{TASK}]",
prompt_func=const_prompt_func_wrapper(
"Extract all the aspects."
),
# knowledge_func=concat_list_knowledge_wrapper("person 2 persona: ", " | "),
knowledge_func=None_knowledge,
label_func=extract_aspects_wrapper(" | ", ", "),
)
)
serial_proc.launch()