To run this project, you need to install the following libraries
- pytorch
- pytorch-pretrained-bert
- spacy
- numpy
- scipy
- scikit-learn
- pyyaml
- adabound
- xlrd==1.2.0
To enable init representation of words, you need to download the glove file from http://nlp.stanford.edu/data/wordvecs/glove.840B.300d.zip, and put the txt file under the 'data' directory.
This project is developed based on capsule network, execute the command 'python run.py' and you will see the results of 'data processing', 'training' and 'testing'.
To see results from different settings, just modify the 'config.py'.
- Run the 'dataset.py', the laptop review files under the 'laptop_raw_data' directory would be combined and generate 'train/val/test' files under the path 'data/raw/', which are all in 'xml' format, recording the correct aspect terms and the corresponding sentiment labels from each given sentence. Note that train : val : test = 8 : 1 : 1 (see line 64 in 'data_utils/data_transfer.py'). Then it generates 'log' and 'processed' folders under the 'data' path, which would be used in training and testing stages.
- Run the 'train.py', which construct model and train the model with 'data/processed/train.xml' and 'data/processed/val.xml'.
- Run the 'test.py', which load the checkpoint learned before and output the test results on 'data/processed/test.xml'.
The website link is the http://plp2022acas.natapp1.cc/index/, we recommend you to visit it on your phone.