Knock, Knock, AI: How Artificial Intelligence Learns to Write Jokes
Anurag Pola
SE-II @ JPMorganChase | Python, React, AWS and Flutter Developer | Discovering Knowledge Graphs, AI/ML, Pega, Data Analytics and more...
Imagine you are trying to build a program that can write "Knock-Knock" jokes. Now there are two ways you can do this, you can choose the classical Rule-based Programming approach or the unconventional AI approach. Let us look at both the approaches.
Rule-based Programming
In this approach, we have a template of the joke and we just have some variables, which fit in to complete the joke.
Now with a set of names and punchlines, allows it to generate "Knock, Knock" jokes. This program is limited though, as it is only capable of producing jokes based on the input we have given it. However, an AI approach offers a solution to this problem, as it can generate original jokes beyond the initial inputs given to it.
Training AI to write a Knock Knock Joke
We are going to look at a use case, an AI created by Janelle Shane mentioned in her book "You Look Like A Thing and I Love You" and it's journey of writing knock-knock jokes.
When employing an AI approach, the program must learn the rules of constructing "Knock, Knock" jokes on its own. At first, the generated jokes may appear nonsensical, as the AI lacks a basic understanding of the English language, yet it is tasked with creating jokes. The AI may produce something along the lines of "qasdnw,m sne?msod", having some concept of using a question mark once. The AI will gradually improve its guessing accuracy as it gains more experience. However, there is a limit to how much the AI can change its output, as we cannot afford to memorize every new piece of text it produces.
With each iteration, the AI adjusts its joke formula to enhance the accuracy of its guesses. It starts with basic concepts such as including a question mark and using vowels and apostrophes.
Then it may stumble upon the delightful discovery that the letter "o" is often followed by "ck" - a moment of pure gold. The perfect joke right now is
Then it tweaks it a little bit and this comes out
In a matter of minutes, the AI is able to make significant progress in its joke-writing formula. However, there is still some confusion when it comes to determining who is telling the joke to whom, leading to a longer period of adjustment for this aspect of the formula.
Soon it figures out the formula for the jokes, but no actual words.Sometimes it gets carries away with the length of punchline too.
领英推荐
Then it learns about the cow with no lips joke
According to AI this is comedy gold. Soooo
Eventually (maybe reluctantly), it tones down on the cow, but has the problem similar to that of two ppl telling knock-knock jokes on a bad phone connection
At last, it figures out the structure and writes a partially plagiarised joke from the training data set
Then it produced an actual joke of it's own
Soooooo
While the AI has made significant progress in generating "Knock, Knock" jokes, it still does not have a complete understanding of the nuances of the English language and puns. However, the freedom that AI possesses - the ability to experiment with a vast range of possible character combinations - enables it to come up with new and innovative joke ideas that may not have been possible through traditional rule-based programming methods. This approach is akin to the Infinite Monkey Theory, which suggests that a monkey randomly typing on a typewriter for an infinite amount of time will eventually produce the complete works of Shakespeare.
Reference
"You Look Like A Thing And I Love You" by Janelle Shane