Frontiers for Young Minds

Frontiers for Young Minds
Menu
Core Concept Neuroscience and Psychology Published: October 24, 2022

Can Computers Understand Humor?

Abstract

Computers are very good at performing many tasks that are difficult for humans, such as solving complicated math problems or predicting the weather. But there are many things that people do better than computers. Humor—that is, telling jokes and knowing when something is funny—is one of the things that computers cannot do as well as humans. In this article, you will learn why it is hard for computers to understand jokes. You will also learn about artificial intelligence (AI), and how a new sub-field of AI, called machine learning, can help computers understand humor. We hope that, in the future, computers will be able to understand and generate humor, just like humans do—or even better!

Computers Can Do Anything… Right?

Computers are a big part of our lives. We all use them for games, homework, watching videos, and much more. But a computer is more than just the laptop or desktop you have at home or at school. The word computer actually means any kind of machine that uses electronic data. For example, cell phones, microwaves, elevators, cars, and even “talking” toys are all types of computers!

Nowadays, the capabilities of computers are extraordinary. They can understand human speech; write music and draw; search for information on the web; diagnose diseases; and even drive a car! But humor is one task which computers still struggle with.

The Challenge: Make Your Computer Laugh

From a young age, we learn to laugh when something is funny and also how to make other people laugh. Humor is an important part of human life—in every culture around the world, people tell jokes and laugh daily. Although humor is very important for humans, computers still struggle with “knowing” when something is funny, let alone being funny themselves. Why? One of the main reasons is that humor is very subjective, meaning that it is different for each person, time, and place. We ourselves often do not know what makes something funny! Sometimes a certain thing makes one person laugh, while another does not find it funny at all. For example, is the following joke funny to you?

Why was 6 afraid of 7? Because 7 ate 9!

Some people may laugh at this joke, and some may not. Since even individual humans may not always agree on what is funny, will computers ever get the joke?

How Can We Explain Humor?

Throughout history, people from fields including philosophy, psychology, and linguistics (the study of languages) have tried to develop scientific theories to answer the question of what makes something funny. In their research, they made some interesting discoveries. One discovery was that, for something to be funny, it must contain some element of surprise. Let us look at this joke, for example:

Mom, I do not want to go to school today!,” Danny said. “The kids are bothering me, and all the teachers hate me.”

“But Danny, you must go,” Mother insisted.

“But why?” Danny asked.

“Because you’re the principal!” Mother replied.

The joke is funny because it is surprising—we expected Danny to be a student! So, all we need is for the computer to be able to identify a “surprise.” Sounds easy, right? Not so fast. We, as human beings, know a lot about how the world works, and we expect certain things to happen because we have experienced them. Computers, on the other hand, do not experience the world like we do. They do not know what “usually” happens and therefore cannot know what is surprising!

So how can we teach a computer about the world?

Artificial Intelligence and Machine Learning

Artificial intelligence (AI) is the field of computer science that tries to make a computer “think” like a human. In the beginning of AI research, computer programmers—people who know how to write instructions for a computer—needed to give the computer very specific rules to get it to do what they wanted. Here is an example of this type of rule from the human world: “If a person goes to the doctor with a fever and cough—they should have a corona test.” Recently, programmers have started using an AI sub-field called machine learning. With machine learning, you do not need to give the computer any rules; instead, the computer learns from examples, much like humans do. This type of learning can help a computer identify surprise and humor.

How Does Machine Learning Work?

Machine learning means that programmers give computers examples, each with a label, or tag, that describes it. After many examples, the computer learns to identify the examples on its own (Figure 1)! Children learn in a similar way—when a child sees an animal (the example), an adult tells the child what kind of animal it is (the tag). With enough examples, the child will learn to identify the animals on his own.

Figure 1 - The process of machine learning.
  • Figure 1 - The process of machine learning.
  • (A) Pictures tagged as “dog” or ”cat” are presented to a computer. The computer learns how to tell the difference between a dog and a cat. (B) A new image without a tag is inserted into the computer. The computer must decide whether the picture is of a dog or a cat. The computer answers that there is a 90% chance this is a dog.

So, can computers learn to understand humor? Yes, they can! With machine learning, computers can solve humor problems that were previously considered impossible.

How We Taught a Computer to Get the Joke

In Professor Dafna Shahaf’s laboratory, researchers study AI, including how to teach computers to understand humor. To do this, we create machine learning models, which you are now familiar with! Professor Shahaf’s first project about computers and humor was based on a contest in an American newspaper called The New Yorker [1]. In this contest, the newspaper publishes a cartoon without any words, and readers are asked to write a funny caption. The reader who comes up with the funniest caption wins. There is a person at the newspaper whose job it is to choose the funniest captions from the thousands that come in every week. Sounds like a fun job, right? Turns out it is not, because after a few weeks of reading so many funny captions, nothing seems funny anymore! Could a computer help the newspaper to pick the funniest submission? Professor Shahaf gave the computer examples of funny captions, and the computer learned to grade them based on how funny they were.

In another project, two researchers in Professor Shahaf’s laboratory—a doctoral student named Chen Shani and a master’s student named Nadav Bornstein—taught a computer to identify funny science projects [2]. You read that right—funny science projects! This project was based on an award called the Ig Nobel Prize, which is a humorous prize given to scientific studies that “first make people laugh, then make them think.” Here are some of the studies that have won this award:

  • A study that found that chickens prefer beautiful people;
  • A study that showed that when people see chimpanzees in the zoo, the chimpanzees copy the humans, and that the humans also copy the chimpanzees;
  • A study that tested saliva (spit) to see if it can be used to clean a dirty surface; and
  • A study that showed that more people are grossed out by cheese than by any other food—even if they only smell it or see a picture of it.

Using machine learning, the researchers taught the computer to pick out funny scientific studies like the ones listed!

Another project, led by Chen Shani together with Amazon, looked at humor and Alexa, Amazon’s virtual voice assistant [3]. People who use Alexa tend to treat her as if she were a human being, and often try to joke with her. For example, they might say: “Hi, Alexa, do you want to build a snowman?” The problem is that Alexa and other programs like her are not designed to understand humor, but to help with daily tasks like searching the Internet or reporting the weather. Therefore, they usually do not understand or respond in the right way when someone is joking around with them, and that is no fun! To teach virtual assistants like Alexa to get the joke, the researchers collected examples of playful queries people ask Alexa, such as “Do you have eyes?;” “Want to go to a movie with me?;” “Order me a million gummy bears;” and more. They used these examples and many more to characterize users’ playfulness, toward automatically detecting it.

Summary

Humor is a great example of a human trait that is still very difficult for computers to understand and use like humans do. But there is hope!

We have seen that computers can understand humor when it comes to certain tasks. Our hope for the future is that we can teach computers to understand humor better and better. Want to help us? The first thing to do is learn computer programming!

Glossary

Artificial Intelligence: A field of science that aims to make a computer “think” and “behave” in ways similar to humans.

Computer Programming: Writing instructions for a computer. Programmers use programming languages to write the codes, or instructions, for applications, websites, and computer software.

Machine Learning: A kind of artificial intelligence in which a computer learns from experience, like humans. Unlike AI, programmers do not need to give the computer instructions, but instead provide examples.

Virtual Voice Assistant: Software that can understand human speech and respond. Its purpose is to help users by performing tasks for them.

Conflict of Interest

The authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.


References

[1] Shahaf, D., Horvitz, E., and Mankoff, R. 2015. “Inside jokes: identifying humorous cartoon captions,” in Proceedings of the 21th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (Sydney). p. 1065–74.

[2] Shani, C., Borenstein, N., and Shahaf, D. 2021. “How did this get funded?! Automatically identifying quirky scientific achievements,” in Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Bangkok). p. 14–28.

[3] Shani, C., Libov, A., Tolmach, S., Lewin-Eytan, L., Maarek, Y., and Shahaf, D. 2022. “‘Alexa, do you want to build a snowman?’ Characterizing playful requests to conversational agents,” in CHI Conference on Human Factors in Computing Systems Extended Abstracts (New Orleans, LA). p. 1–7.