Skip to content
/ TCMSA Public

Code of Tree communication model (TCM) for sentiment analysis.

Notifications You must be signed in to change notification settings

fred2008/TCMSA

Repository files navigation

Tree Communication Models for Sentiment Analysis (TCMSA)

Code of Tree communication model (TCM) for sentiment analysis.

Requirement

Get data

cd data/trees
wget http://nlp.stanford.edu/~socherr/stanfordSentimentTreebank.zip
unzip stanfordSentimentTreebank.zip
rm stanfordSentimentTreebank.zip

Revisit our performance & Test

  • Specify Model: config.py --> 'model4test'
  • Run the script:
# specify gpu in run.sh
./run.sh test_new.py
  • If there is Variable cannot found error, please change the variable name of checkpoint accordingly. tools/rename_model.sh is a script for variable rename of checkpoints:
# the output model is saved in the same directory as model_to_save: model_to_save_new
rename_model.sh model_to_reloade
  • In saved_model/, we release our models under 4 settings.

Train models

  • Obtain initial state from tree-LSTM. We take the tensorflow-fold impletation of tree-LSTM following sentiment.ipynb.
  • Specify initial sate in config.py: 'pre_train'
  • Start to Train:
# specify gpu in run.sh
./run.sh train_new.py

Citation

Please cite our ACL 2019 paper:

@inproceedings{zhang2019tree,
    title = "Tree Communication Models for Sentiment Analysis",
    author={Zhang, Yuan and Zhang, Yue},
    booktitle = "Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics",
    month = jul,
    year = "2019",
    address = "Florence, Italy",
    publisher = "Association for Computational Linguistics",
    pages = "3518--3527",
}

About

Code of Tree communication model (TCM) for sentiment analysis.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages