Skip to content
PyTorch seq2seq implementation. Includes pretrained models for jokes<>punchlines and english<>french.
Branch: master
Clone or download
Latest commit 4b32f38 Apr 16, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
eng_translation_data Clean up directory Apr 15, 2019
jokes_data Merge branch 'master' of github.com:rileynwong/pytorch-seq2seq Apr 16, 2019
models Clean up directory Apr 15, 2019
README.md Update README.md Apr 16, 2019
joke2punchline.py Add scripts for generating jokes and punchlines Apr 15, 2019
punchline2joke.py
seq2seq.py Clean up seq2seq file Apr 10, 2019

README.md

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

You can’t perform that action at this time.