This repository contains data and code for the paper: Dialogue Graph Attention Network in Conversational Aspect-base Sentiment Analysis
In our work, we propose DiaGAT model. The DiaGAT model presents a significant advancement in conversational aspect-based sentiment analysis by effectively leveraging dialogue structure and syntax to improve sentiment analysis accuracy. This model introduces a dual graph attention mechanism, namely Utterance GAT and Token GAT, which are designed to capture the complex dynamics of conversations, particularly in hierarchical relationships and syntactic dependencies.
- Graph-Based Modeling: Constructs a comprehensive graph integrating both reply and syntactic relations across dialogues, capturing the intricate relationships between utterances and within utterances.
- Hierarchical Attention Mechanism: Utilizes two layers of graph attention networks to process different levels of information flow — one at the utterance level and another at the token level, ensuring a robust understanding of the context.
- Enhanced Tagging Scheme: Implements a refined tagging scheme that constrains the prediction space, improving the precision of identifying sentiment-related terms within conversations.
DiaGAT outperforms existing models, including state-of-the-art generative models like GPT-4, in accurately extracting sentiment quadruples from conversations. It demonstrates superior capability in handling complex dialogue scenarios across multiple datasets in both English and Chinese.
DiaGAT root directory ├── data data directory │ └── dataset dataset directory │ ├──jsons_en english dataset directory │ │ ├──train.json english training dataset │ │ ├──valid.json english validation dataset │ │ └──test.json english test dataset │ └──jsons_zh chinese dataset directory │ ├──train.json english training dataset │ ├──valid.json english validation dataset │ └──test.json english test dataset └── src source code of the DiaGAT model ├── common.py ├── preprocess.py encode the dialogue into dialogue graph ├── dataloader.py load the dialogue graph into dataset ├── model.py define architecture of the DiaGAT model ├── metrics.py evaluate the behavior of the model └── config.yaml configuration file to setting many hyper parameters
Our model needs packages to run:
- pytorch >= 1.12.1
- torch-lightning >= 2.0.0
- If you are trainning the model in the first time, you need to initialize the dataset by
python main.py -d True
- Or you can trainning the model directly by
python main.py
If you want to change hyperparameters in the model, you can modify the configuration file src/config
to change config such as language