Giter VIP home page Giter VIP logo

rileynwong / pytorch-seq2seq-joke2punchline Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 42.2 MB

PyTorch seq2seq implementation. Includes pretrained models for jokes<>punchlines and english<>french.

Home Page: https://www.rileynwong.com/blog/2019/4/12/joke2punchline-punchline2joke-using-a-seq2seq-neural-network-to-translate-between-jokes-and-punchlines

Python 100.00%
neural-network neural-networks neural-networks-from-scratch neural-networks-and-deep-learning neural-machine-translation neural-nets jokes punchlines translation machine-learning

pytorch-seq2seq-joke2punchline's Introduction

PyTorch Seq2Seq: Joke2Punchline, Punchline2Joke, and English<>French

PyTorch implementation of the sequence-to-sequence neural network model with attention. Includes pre-trained models for:

  • joke2punchline: Given a question-format joke, output a generated punchline.
  • punchline2joke: Given a punchline, output a generated question-format joke.
  • eng<>fra: Given a French sentence, output its English translation, or vice versa.

See blog posts on seq2seq language translation and for joke2punchline and punchline2joke (contains more examples!).

Joke2Punchline

Given a question-format joke, output a generated punchline.

> what do you call an unpredictable chef ?
< ouch .

> what do you call a pile of pillowcases ?
< screw music 

> why was the sun hospitalized ?
< because he was sitting on me . 

> who s there ?
< in the dictionary . 

> what is red and bad for your teeth ?
< a a gummy bear 

Punchline2Joke

Given a punchline, output a generated question-format joke.

> watermelon concentrate
< when do you stop at green and go at the orange juice factory ? 

> cool space
< what do you call an alligator in a vest with a scoop of ice cream ? 

> the impossible !
< what did the worker say when he swam into the wall ? 

> both !
< what do you call a ghosts mom and dad ? 

> one two three four
< what did the buffalo say to the bartender ? 

Eng2Fra

Given a French sentence, output the English translation.

> je n appartiens pas a ce monde .
= i m not from this world .
< i m not from this world .

> je suis impatient de la prochaine fois .
= i m looking forward to the next time .
< i m looking forward to the next time . 

> tu es sauve .
= you re safe .
< you re safe . 

> vous etes a nouveau de retour .
= you re back again .
< you re back again . 

> il n est pas marie .
= he s not married .
< he s not married . 

Project Overview

  • Scripts:
    • joke2punchline.py: Generate punchlines given jokes.
    • punchline2joke.py: Generate jokes given punchlines.
    • seq2seq.py: Train or translate English<>French sentences.
  • Pre-trained models:
    • models/ directory:
      • Contains trained encoders and decoders for joke2punchline, punchline2joke, and eng<>french.
  • Data:
    • jokes_data/jokes.tsv: Tab-separated file with question-answer format jokes.
    • eng_translation_data/: Contains tab-separated text files with English-French sentence pairs.

Credits

pytorch-seq2seq-joke2punchline's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

sunnys

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.