I've always been a fan of puns and one-line jokes. They can mostly be split up into a few 'classes', outlined in this paper: . Many of the best one-liners are generated by first coming up with a punchline (usually a common idiom or phrase) and then providing an unexpected alternative context for the punchline. For example:

My dad recently signed me up to the organ donation register... he's a man after my own heart.

This formula is used in many of the best one-liners, so I wanted to see whether I could get a computer to generate them. I realised that the scope of this project was too much for a hackathon, so I narrowed it down to instead creating an app that generates "witty" company slogans based on the type of company. For example, for a pottery shop, it might generate the slogan Seize the clay.

How I built it

I initially planned to use Google's NLP Cloud Platform to analyse common idioms and then work backwards to generate some context for them. This proved unfeasible. I then resorted to writing a scraper in Javascript to get a list of common idioms online, and then use a rhyming dictionary API combined with a text analysis API to generate witty slogans.

Challenges I ran into

I ended up spending basically a whole day trying to get Google's Cloud Platform set up. I'm really bad at setting things up server-side so this ended up being a massive timesink and I unfortunately didn't manage it in the end.

Accomplishments that I'm proud of

I think my methodology was pretty solid, I just didn't manage to execute it properly :(

What I learned

Never underestimate the amount of time it can take to get a dev environment up and running.

What's next for punerator

I'd like to continue developing it in my spare time, making small improvements as I think of them, and hopefully start submitting some of Punerator's jokes to competitions.

Built With

Share this project: