TransECPE
Transition-based Directed Graph Direction for Emotion-Cause Pair Extraction
Install / Use
/learn @HLT-HITSZ/TransECPEREADME
Introduction
This repository was used in our paper:
“Transition-based Directed Graph Construction for Emotion-Cause Pair Extraction”
Chuang Fan, Chaofa Yuan, Jiachen Du, Lin Gui, Min Yang, Ruifeng Xu. ACL 2020
Please cite our paper if you use this code.
Prerequisites
Python 3.6
Pytorch 1.1.0
CUDA 10.0
BERT - Our bert model is adapted from this implementation: https://github.com/huggingface/pytorch-pretrained-BERT
Descriptions
Data - A dir where contains resources used in this code.
bert-base-chinese: Put the download Pytorch bert model here.DataSplits: A dir where contains 20 different training/validation/test splits in a ratio of 8:1:1. Each sub-dir contains four file: saved_results.txt, train.pkl, valid.pkl and test.pkl.saved_results.txt: The results of test set for emotion extraction, cause extraction and emotion-cause pair extraction. We adopt early stopping strategy, and the highest F-measure model on the validation set is used to evaluate the test set.train.pkl: A list where contains two items. train[0] is a list of document and train[1] is a list of the correspondding emotion-cause pairs. For example, train[0][0]="Last week, I lost my phone where shopping, I feel sad now", then train[1][0]=[(2, 1)].valid.pkl: Similar to train.pkl.test.pkl: Similar to train.pkl.
doc2pair.pkl: A dict where the key is the content of a document, and the value is the correspondding emotion-cause pairs.
Utils - A dir where contains several python scripts used in this code.
Evaluation.py: Used to evaluate the performance of the proposed model.Metrics.py: Metrics for emotion extraction, cause extraction and emotion-cause pair extractions.PrepareData.py: The scipt for preparing data.Transform.py: Transforming documents to a sequence of defined actions and parser states from left-to-right based on the emotion-cause pairs.
Config.py - The script holds all the model configuration.
TransModule.py - The script where contains the proposed transition-based model.
Run.py - The main script to train and evaluate the proposed transition-based model on different splits.
Usage
python3 Run.py
Related Skills
node-connect
347.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
