FunnyBone Deboned: Humour Sorting Workings

I’m currently interning at Datamuse, a NLP company that created brainstorming tools including RhymeZone and OneLook Thesaurus. I was assigned a task where I read through Cockamamie Gobbledegook for Nincompoops, a NLP research paper, then I used some of its ideas to create a tech demo that ranks over 2,000,000 words and phrases by their perceived level of humour.

Having written all of my code under the MIT liscence — alongside permission from my boss — I gave the demo a new user interface, which I released as FunnyBone. The post below comes from the “How it Works” section of the demo.

Funniness Scoring

FunnyBone uses AI to determine the funniness of a word. It starts off with a human reference point (i.e. a set of words whose funniness scores were manually marked), then it extrapolates this data using linear regression, a machine learning model, to predict the funniness of any arbitrary word. The predictions are then stored in a database for quick retrieval when needed.

What words to predict? The set of words comes from Datamuse. Incidentally, FunnyBone uses Datamuse’s public API to find words that are semantically related to the user’s prompt — the API and the database have the same vocabulary, so all possible outputs are given a funiness score.

The funniness scoring borrows ideas from Cockamamie Gobbledegook for Nincompoops, a NLP research paper.

Web App Interactions

The back-end for FunnyBone is a Flask app. When the page is loaded, the app reads the user’s prompt from the URL query string. Then it finds candidate outputs using the aforementioned Datamuse API and retrieves their funniness scores from the database. The 3 funniest words, along with the unfunniest word, are noted.

All necessary information is passed on to the front-end, an HTML page generated through Jinja2 templating. When the user enters a prompt, the page is reloaded with the new prompt reflected in the query string, repeating the cycle.

Putting It Together

Here’s a diagram of how everything fits together:

FunnyBone Flowchart

Thank you to Doug Beeferman, my boss at Datamuse, who guided me and pointed me towards the resources I needed to complete this project.