Skip to content

AniSkywalker/SarcasmDetection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SarcamDetection

Sarcasm detection on tweets using neural network.
[This repository] perform[s] semantic modelling of sentences using neural networks for the task of sarcasm detection (Ghosh & Veale, 2016).

Pre-requisite

  • nltk (TweetTokenizer)
  • Keras
  • Tensorflow
  • numpy
  • scipy
  • gensim (if you are using word2vec)
  • itertools

Cloning the repository

git clone git@github.com:AniSkywalker/SarcasmDetection.git
cd SarcasmDetection/src/

If you want to use the pre-trained model, you'll have to download it from Google Drive and save it into /resource/text_model/weights/.

Using this package

This code is run by the following command:

python sarcasm_detection_model_CNN_LSTM_DNN.py

Citation

Please cite the following paper when using this code:

Fracking Sarcasm using Neural Network.
Aniruddha Ghosh and Tony Veale. 7th Workshop on Computational Approaches to Subjectivity, Sentiment and Social Media Analysis (WASSA 2016). NAACL-HLT. 16th June 2016, San Diego, California, U.S.A.

Output

The supplied input is rated as either 0 meaning non-sarcastic or 1 meaning sarcastic.

Training

If you want to train the model with your own data, you can save your train, development and test data into the /resource/train, /resource/dev and /resource/test folders correspondingly.

The system accepts dataset in the tab separated format — as shown below. An example can be found in /resource/train/train_v1.txt.

id<tab>label<tab>tweet

Context information

To run the model with context information and psychological dimensions (using Tensorflow) run:

python sarcasm_context_moods.py

Citation

Please cite the following paper when using context information and psychological dimensions:

Magnets for Sarcasm: Making Sarcasm Detection Timely, Contextual and Very Personal
Aniruddha Ghosh and Tony Veale. Conference on Empirical Methods in Natural Language Processing (EMNLP). 7th-11th September, 2017, Copenhagen, Denmark.

Notes