Giter Club home page Giter Club logo

shakespearizing-modern-english's Introduction

Shakespearizing-Modern-English

Code for "Jhamtani H., Gangal V., Hovy E. and Nyberg E. Shakespearizing Modern Language Using Copy-Enriched Sequence to Sequence Models" Workshop on Stylistic Variation, EMNLP 2017

Code has been tested with Tensorflow version 1.1.0

  • If you use this code or the processed data, please consider citing Jhamtani H., Gangal V., Hovy E. and Nyberg E. Shakespearizing Modern Language Using Copy-Enriched Sequence to Sequence Models" Workshop on Stylistic Variation, EMNLP 2017
  • If you use the data, please consder citing "Wei Xu, Alan Ritter, William B Dolan, Ralph Grish- man, and Colin Cherry. 2012. Paraphrasing for style. In 24th International Conference on Computational Linguistics, COLING 2012."

Instructions to run:
Preprocessing:

  • Change working directory to code/main/
  • Create a new directory named 'tmp'
  • python mt_main.py preprocessing

Pointer model:

  • First run pre-processing
  • Change working directory to code/main/
  • python mt_main.py train 10 pointer_model
    For inference:
  • Change working directory to code/main/
  • python mt_main.py inference tmp/pointer_model7.ckpt greedy

Normal seq2seq model:

  • First run pre-processing
  • Change working directory to code/main/
  • python mt_main.py train 10 seq2seq
    For inference:
  • Change working directory to code/main/
  • python mt_main.py inference tmp/seq2seq5.ckpt greedy

Post-Processing: There are two post-processing actions which one may be interested in performing:

  1. Visualizing attention matrices
  2. Replacing UNKS in hypothesis with their highest-aligned (attention) input tokens. For both of these actions, refer to the running instructions in code/main/post_process.py (comments commencing the file). The file can be run in two modes, to perform 1 (write) and 2 (postProcess) respectively*. *Not elaborated on here to preserve conciseness and clarity.

Baseline (Dictionary):

  • Change working directory to code/baselines/
  • python dictionary_baseline.py ../../data/shakespeare.dict ../../data/test.modern.nltktok ../../data/test.dictBaseline
  • The test.dictBaseline file contains the output (Shakespearean) of the dictionary baseline.
  • To evaluate BLEU:
    • Change working directory to code/main/
    • perl multi-bleu.perl -lc ../../data/test.original.nltktok < ../../data/test.dictBaseline

Baseline (statistical MT)

  • Please follow instructions in "Wei Xu, Alan Ritter, William B Dolan, Ralph Grish- man, and Colin Cherry. 2012. Paraphrasing for style. In 24th International Conference on Computational Linguistics, COLING 2012."

shakespearizing-modern-english's People

Contributors

harsh19 avatar vgtomahawk 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.