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!).
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
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 ?
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 .
- 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.
- PyTorch seq2seq tutorial
- Clean question-answer format jokes: 1 2 3
- Language pairs data from the Tatoeba Project