Skip to content

BinLiang-NLP/Sentic-GCN

Repository files navigation

Sentic GCN: A Simple But Effective Framework for Aspect-Based Sentiment Analysis via Affective Knowledge Enhanced GCN

Introduction

This repository was used in our paper:

Aspect-Based Sentiment Analysis via Affective Knowledge Enhanced Graph Convolutional Networks
Bin Liang, Hang Su, Lin Gui, Erik Cambria, Ruifeng Xu. Knowledge-Based Systems, 2021: 107643.

Please cite our paper and kindly give a star for this repository if you use this code.

Requirements

  • Python 3.6
  • PyTorch 1.0.0
  • SpaCy 2.0.18
  • numpy 1.15.4

Usage

  • Please download Glove Embedding, and put 'glove.42B.300d.txt' under the main directory.

  • Install SpaCy package and language models with

pip install spacy

and

python -m spacy download en
  • Generate dependency graph with
python generate_dependency_graph.py
  • Generate sentic graph with
python generate_sentic_graph.py
  • Generate sentic & dependeny graph with
python generate_sentic_dependency_graph.py

Training

  • Train with command, optional arguments could be found in train.py & train_bert.py

  • Please tune the argument of --seed for better performance

  • Run senticgcn: ./run_senticgcn.sh

  • Run senticgcn_bert: ./run_senticgcn_bert.sh

Testing

  • Testing with the models saved in state_dict. Optional arguments could be found in infer.py & infer_for_bert.py
  • Please run python infer.py for the testing of non-BERT models.
  • Please run python infer_for_bert.py for the testing of BERT-based models.

Citation

The BibTex of the citation is as follow:

@article{liang2021aspect,
  title={Aspect-based sentiment analysis via affective knowledge enhanced graph convolutional networks},
  author={Liang, Bin and Su, Hang and Gui, Lin and Cambria, Erik and Xu, Ruifeng},
  journal={Knowledge-Based Systems},
  pages={107643},
  year={2021},
  publisher={Elsevier}
}

See Also

Credits

  • The affective knowledge used in this work is from SenticNet.
  • Here, we would like to express our heartfelt thanks to all the authors of SenticNet.
  • The code of this repository partly relies on ASGCN & ABSA-PyTorch.
  • Here, we would like to express our gratitude to the authors of the ASGCN & ABSA-PyTorch repositories.

About

[KBS] Aspect-based sentiment analysis via affective knowledge enhanced graph convolutional networks

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages