Git Product home page Git Product logo

transcap's Introduction

TransCap

Code and dataset of our paper "Transfer Capsule Network for Aspect Level Sentiment Classification" accepted by ACL 2019.

1. Requirements

  • python 3.6
  • tensorflow 1.3.0
  • spacy 1.9.0
  • numpy 1.16.4
  • scikit-learn 0.21.2

2. Usage

We incorporate the training and evaluation of TransCap in the main.py. Just run it as below.

CUDA_VISIBLE_DEVICES=0 python main.py --ASC restaurant --DSC yelp

3. Embeddings

We have generated the word-idx mapping file and the word embedding file in ./data/restaurant and ./data/laptop. If you want to generate them from scratch, follow the steps below. We take restaurant(ASC) + yelp(DSC) for an example.

  • Download glove.840B.300d.txt and put it in ./data.
  • Execute CUDA_VISIBLE_DEVICES=0 python main.py --ASC restaurant --DSC yelp --reuse_embedding False.
  • Related files will be generated in ./data/restaurant.

4. Run TransCap on Other Datasets

If you want to run TransCap on a new-coming dataset (e.g., 'XXX'), follow the instructions below.

  • Create the folder ./data/XXX , generate the ASC files, and put them in corresponding folders like ./data/XXX/train.
  • Generate the DSC files (e.g., files start with 'YYY') and put them in ./data/XXX/train.
  • Copy ./data/restaurant/balance.py and put it in ./data/XXX.
  • Run ./data/XXX/balance.py to get balanced ASC files.
  • Execute CUDA_VISIBLE_DEVICES=0 python main.py --ASC XXX --DSC YYY --reuse_embedding False to run TransCap on the XXX dataset.

5. Citation

If you find our code and dataset useful, please cite our paper.

@inproceedings{chen2019transcap,
  author    = {Zhuang Chen and Tieyun Qian},
  title     = {Transfer Capsule Network for Aspect Level Sentiment Classification},
  booktitle = {ACL},
  pages     = {547--556},
  year      = {2019},
  url       = {https://doi.org/10.18653/v1/p19-1052}
}

transcap's People

Contributors

nlpwm-whu avatar zhchen18 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

transcap's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.