This repository contains the data and code for the paper "A Challenge Dataset and Effective Models for Aspect-Based Sentiment Analysis", EMNLP-IJCNLP 2019, [paper].
MAMS is a challenge dataset for aspect-based sentiment analysis (ABSA), in which each sentences contain at least two aspects with different sentiment polarities. MAMS dataset contains two versions: one for aspect-term sentiment analysis (ATSA) and one for aspect-category sentiment analysis (ACSA).
pytorch==1.1.0
spacy==2.1.8
pytorch-pretrained-bert==0.6.2
adabound==0.0.5
pyyaml==5.1.2
numpy==1.17.2
scikit-learn==0.21.3
scipy==1.3.1
Put the pretrained GloVe(http://nlp.stanford.edu/data/wordvecs/glove.840B.300d.zip) file glove.840B.300d.txt
in folder ./data
.
Modify config.py
to select task, model and hyper-parameters. When mode is set to term
, base_path should point to an ATSA dataset. When mode is set to category
, base_path should point to an ACSA dataset.
python preprocess.py
python train.py
python test.py
The BERT model pretrained by huggingface(https://github.com/huggingface/pytorch-transformers) is used in our experiments.