Coder Social home page Coder Social logo

kumar-tarun / metaphor-detection Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 40 KB

Code for the paper "Character aware models with similarity learning for metaphor detection".

Home Page: https://www.aclweb.org/anthology/2020.figlang-1.18/

Python 100.00%
metaphor natural-language-processing deep-learning figurative-language python3

metaphor-detection's Introduction

About

This repository describes our system for the task of Metaphor Detection.

Information about files

Environment

  • The environment used is python 3.6 with pytorch 1.4 with standard libraries - allennlp, sklearn, numpy, pandas, matplotlib, nltk, tqdm etc.

Data

  • Run python util.py to make required directories.
  • Download GloVe embeddings from here, unzip them and place the text file in ./data/ folder.
  • Download VUA data from here and prepare the following files - vuamc_corpus_train.csv, vuamc_corpus_test.csv, all_pos_test_tokens.csv and verb_test_tokens.csv and place all of these in ./data/vua/ folder.
  • For downloading TOEFL dataset, you need to fill an agreement here. Next, rename the essays/ folder of training partition as train_essays/ and place it in ./data/toefl/ folder, similarly rename essays/ folder from test partition as test_essays/ and place it in ./data/toefl/ folder. Also, place all_pos_test_tokens.csv and verb_test_tokens.csv in ./data/toefl/ folder.

Use

  • Run python data_preparation.py [option], where option vua creates all files (including ELMo vectors) for the VUA dataset and toefl for the TOEFL dataset. This script also splits the training dataset into train and validation sub parts. Note it takes time to compute the ELMo vectors.
  • Run python main_xyz.py to run the experiments on the respective dataset. It will store the produced graphs in ./graphs/xyz/ folder. It also produces the test predictions which are stored as xyz_all_pos_pred.csv and xyz_verb_pred.csv in the ./predictions/ folder.

Note

  • The outputs here are expected to match the results reported in paper for the single run case.
  • For ensembling, the code is not provided, one can run different models by varying hyperparameters of the model (as mentioned in paper) and aggregate by majority voting.

Credits

Citation

  • If you find this work useful, consider citing it:
@inproceedings{kumar-sharma-2020-character,
    title = "Character aware models with similarity learning for metaphor detection",
    author = "Kumar, Tarun  and
      Sharma, Yashvardhan",
    booktitle = "Proceedings of the Second Workshop on Figurative Language Processing",
    month = jul,
    year = "2020",
    address = "Online",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/2020.figlang-1.18",
    pages = "116--125",
}

metaphor-detection's People

Contributors

kumar-tarun avatar

Stargazers

 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.