Coder Social home page Coder Social logo

social-attention's Introduction

Sentiment Analysis with Social Attention

Author: Yi Yang

Contact: [email protected]

Basic description

This is the Python implementation of the social attention model for sentiment analysis, described in

Yi Yang and Jacob Eisenstein "Overcoming Language Variation in Sentiment Analysis with Social Attention", TACL 2017

[pdf], [BibTex]

Dependencies

  1. Theano
  2. Keras
  3. Optional: CUDA Toolkit for GPU programming.

Data

In order to reproduce the results reported in the paper, you will need

  1. The SemEval 2015 Twitter sentiment analysis datasets, as described in this paper.
    • The data is available in the data/txt folder. Unfortunately, the text content is not available due to Twitter policy. You need to replace "content" with the real tweets.
    • You can preprocss the raw tweets using (tweet = normalizeTextForSentiment(tokenizeRawTweetText(tweet), True)), which can be found in twokenize.py.
  2. The pretrained word embeddings (don't right click the link---use left click and Save link As...). You can save the file in data/word_embeddings.
  3. The pretrained author embeddings, which are available in data/author_embeddings.

Reproduce results

Great, now you are ready to reproduce the results

  1. Prepare the data, and generate the required data file semeval.pkl (available here)

    python process_data.py data/word_embeddings/struc_skip_600.txt \
                           data/semeval.pkl \
                           data/txt/train_2013.txt \
                           data/txt/dev_2013.txt \
                           data/txt/test_2013.txt \
                           data/txt/test_2014.txt \
                           data/txt/test_2015.txt 
    
  2. Reproduce CNN baseline results

    python cnn_baseline.py data/semeval.pkl 
    
  3. Reproduce mixture of experts baseline results

    python mixture_expert.py data/semeval.pkl 
    
  4. Reproduce concatenation baseline results

    python concat_baseline.py data/semeval.pkl data/author_embeddings/retweet.emb
    
  5. Reproduce SOCIAL ATTENTION results

    python social_attention.py data/semeval.pkl data/author_embeddings/retweet.emb
    
  6. Run with pre-trained model (Test13 F1: 71.7 Test14 F1: 75.6 Test15 F1: 66.8 Average: 71.4)

    python run_social_attention.py test data/semeval.pkl data/author_embeddings/retweet.emb model/social_attention_model.h5
    

social-attention's People

Contributors

yiyang-gt 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  avatar  avatar

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.