Can computers tell a good joke? Is comedy just a matter of statistics or is there something only a human can bring to creating a joke? A joke generator created at the University of Edinburgh suggests that AI can be funny.

I like my jokes like my AI, heuristic.

This is an example of an "I like my X like my Y, Z" and software is now almost as good as humans at creating examples that are funny. Two researchers, Sasa Petrovic and David Matthews at the School of Informatics University of Edinburgh have put together a statistical model that can generate such gags - and yes people, real humans, found them funny:

I like my relationships like I like my source, open

I like my coffee like I like my war, cold

I like my boys like I like my sectors, bad

OK, so they are a bit groan-worthy but they are recognizably jokes.

The method used is interesting. The jokes need two nouns, X and Y, and an attribute, Z, and it is postulated that:

a joke is funnier the more often the attribute is used to describe both nouns a joke is funnier the less common the attribute is a joke is funnier the more ambiguous the attribute is,

and a joke is funnier the more dissimilar the two nouns are.

You can verify that these are reasonable by just looking at a few human generated examples.

The model as a factor graph

The problem in implementing such a model is in getting the necessary data. The word frequencies needed were gathered from Google's n-gram database, which was augmented by tagging words with their part of speech using Wordnet. This was then used to work out how often each noun occurred with the same attribute and the other statistics needed to apply the rules given above.

Next some human jokes, harvested from Twitter, were mixed in and a people were asked to rate the set as funny or not funny. Of the human jokes 33% were judged to be funny compared to the computer generated jokes of which 16% were funny. You could say that currently AI is half as funny as a human.

The joking doesn't stop there as the authors also couldn't resist naming their computation of the log likelihood of a joke as the LOcal Log-likelihood or LOL and when ranked according to LOL we get Rank OF Likelihood or ROFL. Hmmm.

And the paper concludes with:

"Finally, we thank the inhabitants of offices 3.48 and 3.38 for putting up with our sniggering every Friday afternoon."

Of course, no understanding or creativity was used in the production of the jokes. The whole exercise is about a statistical model that has a high likelihood, or should that be LOL, of producing a group of words that a human finds funny.

One interesting observation is that the human arbiters of "funniness" disagreed more on the human jokes than on the computer jokes. Presumably human jokes contain cultural or personal references that mean that some other humans don't get the joke.