Giter VIP home page Giter VIP logo

sarcasmgeneration-acl2020's Introduction

Please leave a star if you use our code

The input for our experiments are located in the folder data/non-sarcastic.txt

The generation for our paper is a three staged pipeline process

We convert a non-sarcastic utterance to a sarcastic

R-3

conda create --name R3 python=3.6

conda activate R3

#point your LD_LIBRARY_PATH to your miniconda or anaconda library

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/nas/home/tuhinc/miniconda3/lib/

Clone this repo.

  • cd SarcasmGeneration-ACL2020

  • install nltk

  • To just reverse the valence of the input (REVERSE)

    • Run python reverse.py $input
    • This will print the output in the console
  • To retrieve the commonsense keyword associated with the input you need to do the below(RETRIEVE)

    - Download a chunk of the retreival corpus from the timestamp of the experiment from the link below and put inside data folder (https://drive.google.com/file/d/1cX-iy58B0F1K2nVD5sMiSIxd-8lFx7ok/view?usp=sharing)
    • cd comet-commonsense

      To run the setup scripts to acquire the pretrained model files from OpenAI, as well as the ATOMIC and ConceptNet datasets

      bash scripts/setup/get_atomic_data.sh
      bash scripts/setup/get_conceptnet_data.sh
      bash scripts/setup/get_model_files.sh
      

      Then install dependencies (assuming you already have Python 3.6 ):

      pip install torch==1.3.1
      pip install tensorflow
      pip install ftfy==5.1
      conda install -c conda-forge spacy
      python -m spacy download en
      pip install tensorboardX
      pip install tqdm
      pip install pandas
      pip install ipython
      pip install inflect
      pip install pattern
      pip install pyyaml==5.1
      
      

      Making the Data Loaders

      Run the following scripts to pre-initialize a data loader for ATOMIC or ConceptNet:

      python scripts/data/make_atomic_data_loader.py
      python scripts/data/make_conceptnet_data_loader.py
      

      Download pretrained COMET

      First, download the pretrained models from the following link:

      https://drive.google.com/open?id=1FccEsYPUHnjzmX-Y5vjCBeyRt1pLo8FB
      

      Then untar the file:

      tar -xvzf pretrained_models.tar.gz
      
      
      

Make sure your directory resembles this https://github.com/tuhinjubcse/SarcasmGeneration-ACL2020/blob/master/comet-commonsense/directory.md

  • Finally to generate sarcasm , pick an utterance from data/non-sarcastic.txt and run the following command which inclueds REVERSE , RETRIEVE , RANK together

    • Run python generate_sarcasm.py $input
    • This will print the output in the console

Email me at [email protected] for any problems/doubts. Further you can raise issues on github, or suggest improvements.

If you use code or data please cite us

      @inproceedings{chakrabarty-etal-2020-r,
   title = "{R}{\^{}}3: Reverse, Retrieve, and Rank for Sarcasm Generation with Commonsense Knowledge",
   author = "Chakrabarty, Tuhin  and
     Ghosh, Debanjan  and
     Muresan, Smaranda  and
     Peng, Nanyun",
   booktitle = "Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics",
   month = jul,
   year = "2020",
   address = "Online",
   publisher = "Association for Computational Linguistics",
   url = "https://www.aclweb.org/anthology/2020.acl-main.711",
   pages = "7976--7986",
}

sarcasmgeneration-acl2020's People

Contributors

tuhinjubcse 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

Watchers

 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.