|
import sys |
|
sys.path.append("modules/preprocess") |
|
|
|
from preprocessor.SerialPreprocessor import SerialConfig, SerialPreprocessor |
|
from const import ( |
|
CHARACTER_IDENTIFICATION |
|
) |
|
from preprocessor.prompt_funcs import const_prompt_func_wrapper |
|
from preprocessor.knowledge_funcs import ( |
|
None_knowledge, |
|
|
|
) |
|
from preprocessor.label_funs import ( |
|
extract_characters, |
|
) |
|
from preprocessor.process_turn_funcs import introduce_mention_to_utterance_wrapper |
|
import sys |
|
|
|
if __name__ == "__main__": |
|
TASK = CHARACTER_IDENTIFICATION |
|
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( |
|
"Predict all characters mentioned in the given dialogue marked by [ mention ] tag based on the context." |
|
), |
|
knowledge_func=None_knowledge, |
|
|
|
label_func=extract_characters, |
|
all_turns_process_func=introduce_mention_to_utterance_wrapper(" [ ", " ] "), |
|
) |
|
) |
|
|
|
serial_proc.launch() |
|
|
|
|