Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
hiyouga committed Apr 25, 2021
1 parent 5f2dcee commit ceca279
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 11 deletions.
77 changes: 66 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,87 @@
# RepWalk

Dataset and code for our AAAI 2020 paper "Replicate, Walk, and Stop on Syntax: an Effective Neural Network Model for Aspect-Level Sentiment Classification"
Code and dataset for our AAAI 2020 paper "Replicate, Walk, and Stop on Syntax: an Effective Neural Network Model for Aspect-Level Sentiment Classification".

You can download the paper via: [[Github]](https://github.com/hiyouga/RepWalk/blob/master/paper.pdf) [[DOI]](https://doi.org/10.1609/aaai.v34i05.6517).

## One-Sentence Summary

RepWalk effectively utilizes the dependency grammar to tackle the aspect-level sentiment classification task via performing a replicated random walk on the syntax graph for learning a better sentence representation.

![model_structure](assets/model.jpg)

## Abstract

Aspect-level sentiment classification (ALSC) aims at predicting the sentiment polarity of a specific aspect term occurring in a sentence. This task requires learning a representation by aggregating the relevant contextual features concerning the aspect term. Existing methods cannot sufficiently leverage the syntactic structure of the sentence, and hence are difficult to distinguish different sentiments for multiple aspects in a sentence. We perceive the limitations of the previous methods and propose a hypothesis about finding crucial contextual information with the help of syntactic structure. For this purpose, we present a neural network model named RepWalk which performs a replicated random walk on a syntax graph, to effectively focus on the informative contextual words. Empirical studies show that our model outperforms recent models on most of the benchmark datasets for the ALSC task. The results suggest that our method for incorporating syntactic structure enriches the representation for the classification.

## Requirement

- Python 3.6
- PyTorch 1.2.0
- NumPy 1.17.2
- GloVe pre-trained word vectors:
- Download pre-trained word vectors [here](https://github.com/stanfordnlp/GloVe#download-pre-trained-word-vectors).
- Extract the [glove.840B.300d.zip](https://nlp.stanford.edu/data/wordvecs/glove.840B.300d.zip) to the `/glove/` folder.

## Installation
## Preparation

An easy way to install this code with anaconda environment:
### Clone

```bash
conda create -n repwalk python=3.6
git clone https://github.com/hiyouga/RepWalk.git
```

### Create an anaconda environment [Optional]:

```bash
conda create -n repwalk
conda activate repwalk
pip install -r requirements.txt
```

### Prepare the training data:

- The dataset files are already in the `data` folder.
- The directory structure is as follows:
```
data
├── Restaurants_Trial.json
├── Restaurants_Train.json
├── Restaurants_Test.json
├── Laptops_Trial.json
├── Laptops_Train.json
├── Laptops_Test.json
├── Tweets_Train.json
├── Tweets_Test.json
├── Restaurants16_Trial.json
├── Restaurants16_Train.json
└── Restaurants16_Test.json
```

### Download the pretrained embeddings:

- Download pre-trained word vectors [here](https://nlp.stanford.edu/projects/glove/).
- Extract the [glove.840B.300d.zip](https://nlp.stanford.edu/data/glove.840B.300d.zip) to the `glove` folder.

## Usage

Training the model:
### Train the model:

```bash
python train.py --dataset [dataset]
```

Show help message and exit:
### Show help message and exit:

```bash
python train.py -h
```

## File Specifications

- **model.py**: Description for the model architecture.
- **data_utils.py**: Used functions for data preprocessing.
- **layer.py**: Description for the LSTM layer.
- **loss_func.py**: The loss function for optimizing the models.
- **train.py**: The scripts for training and evaluating the models.

## Citation

If this work is helpful, please cite as:
Expand All @@ -43,11 +90,19 @@ If this work is helpful, please cite as:
@inproceedings{zheng2020replicate,
title={Replicate, Walk, and Stop on Syntax: an Effective Neural Network Model for Aspect-Level Sentiment Classification},
author={Yaowei, Zheng and Richong, Zhang and Samuel, Mensah and Yongyi, Mao},
booktitle={AAAI},
booktitle={{AAAI}},
year={2020}
}
```

## Acknowledgments

This work is supported partly by the National Natural Science Foundation of China, by the Beijing Advanced Innovation Center for Big Data and Brain Computing (BDBC), by State Key Laboratory of Software Development Environment and by the Beijing S&T Committee.

## Contact

hiyouga [AT] buaa [DOT] edu [DOT] cn

## License

MIT
MIT
Binary file added assets/model.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified paper.pdf
Binary file not shown.

0 comments on commit ceca279

Please sign in to comment.