Download presentation
Presentation is loading. Please wait.
1
Computational Approach To Recognizing Wordplay In Jokes Julia M. Taylor & Lawrence J. Mazlack Applied Artificial Intelligence Laboratory University of Cincinnati
2
Introduction Computational recognition of humor is difficult Requires natural language understanding World knowledge This is an initial investigation into computational humor recognition using wordplay Learns statistical patterns of text Recognizes utterances similar in pronunciation to a given word Determines if found utterances transform a text into a joke
3
Subclass of Humor: Joke A joke is a short humorous piece of literature in which the funniness culminates in the final sentence Most jokes have: Setup – the first part of the joke which establishes certain expectations Punchline – much shorter part of joke, causes some form of conflict Force another interpretation Violate expectation “Is the doctor home?” the patient asked in his bronchial whisper. “No,” the doctor’s young and pretty wife whispered in reply. “Come right in.”
4
Computational Humor Computation humor generators, examples: Light bulb joke generator Joke generator that focuses on witticisms based around idioms Generator of humorous parodies of existing acronyms Generator of a humorous sentence based on alphanumeric password Pun generators Computational humor recognizer
5
Wordplay Jokes Depend on words that are similar in sound but have different meaning Same pronunciation, same spelling Same pronunciation, different spelling Similar pronunciation, different spelling The difference in meaning creates conflict or breaks prediction Nurse: I need to get your weight today. Impatient patient: Three hours and twelve minutes. weight=wait
6
Statistical Language Recognition N-grams Model that uses conditional probability to predict N th word based on N-1 previous words. Probabilities depend on the training corpus Find a word with largest P(word |“is”) A newspaper reporter goes around the world with his investigation. He stops people on the street and asks them: “Excuse me, what is your opinion of the meat shortage?” An American asks: “What is ‘shortage’?” A Russian asks: “What is ‘opinion’?” A Pole asks: “What is ‘meat’?” A New York taxi-driver asks: “What is ‘excuse me’?” The Parisian Little Moritz is asked in school: “How many deciliters are there in a liter of milk?” He replies: “One deciliter of milk and nine deciliters of water.” – In France, this is a good joke; in Hungary, this is a good milk.
7
Possible Methods for Joke Recognition Determine if a given text is a joke Given a joke, determine the punchline location Hotel clerk: Welcome to our hotel Max: Thank you. Can you tell me what room I’m in? Clerk: The lobby
8
Restricted Domain: Knock Knock Jokes Line 1 : “Knock, Knock” Line 2 : “Who’s there?” Line 3 : any phrase Line 4 : Line 3 followed by “who?” Line 5 : One or several sentences containing one of the following Type 1 : Line 3 Type 2 : A wordplay on Line 3 Type 3 : A meaningful response to a wordplay of Line 4
9
Restricted Domain: Knock Knock Jokes Type 1 : Line 3 --Knock, Knock --Who’s there? --Water --Water who? --Water you doing tonight? Type 2 : A wordplay on Line 3 --Knock, Knock --Who’s there? --Ashley --Ashley who? --Actually, I don’t know. Type 3 : A meaningful response to a wordplay of Line 4 --Knock, Knock --Who’s there? --Tank --Tank who? --You are welcome.
10
Script-based Semantic Theory of Humor The text is compatible with 2 different scripts The 2 scripts are opposite –Knock, Knock –Who’s there? –Water –Water who? –Water you doing tonight? Scripts overlap in phonetics representation of water and what are Scripts differ in meaning
11
Experimental Design Definitions: Wordplay: a word that sounds similar but has a different spelling (and meaning) What are is a wordplay on water Keyword: what wordplay is based on (Line 3 ) Water is a keyword Recognize only Type 1 jokes
12
Experimental Design --Knock, Knock --Who’s there? --Water --Water who? --Water you doing tonight? Step1: joke format validation Step2: computational generation of sound-alike sequences Step3: validations of meaning of a chosen sound-alike sequence Step4: last sentence validation with sound-alike sequence
13
Experimental Design Training set: 66 Knock Knock jokes Enhance similarity table of letters Select N-gram training texts 66 texts containing wordplay from 66 training jokes Test set: 130 Knock Knock jokes 66 Non-jokes that have similar structure to Knock Knock jokes Water is cold.
14
Experimental Design Similarity Table Contains combination of letters that sound similar Based on similarity table of cross- referenced English consonant pairs Modified by: o translating phonemes to letters o adding vowels that are close in sound o adding other combinations of letters that may be used to recognize wordplay Segment of similarity table
15
Experimental Design Training texts were entered into N-gram database Wordplay validation: bigram table Pairs of words from training texts with count of their occurrences (training texts 1) (texts were 1) (were entered 1) (entered into 1)… Punchline validation: trigram table Three words in a row from training texts with count of their occurrences (training texts were 1) (texts were entered 1) (were entered into 1)
16
Step 1: Joke Format Validation Line 1 : “Knock, Knock” Line 2 : “Who’s there?” Line 3 : any phrase Line 4 : Line 3 followed by “who?” Line 5 : One or several sentences containing Line 3 –Knock, Knock –Who’s there? –Water –Water who? –Water you doing tonight? –Knock, Knock –Who’s there? –Water –Water who? –What are you doing tonight?
17
Step 2: Generation of Wordplay Sequences Repetitive letter replacements of Line 3 Similarity used for letter replacements Resulting utterances are ordered according to their similarity with Line3 Utterances with highest similarity are checked for decomposition into several words Words have to be in Webster's Second International (234,936 words) Segment of similarity table
18
Step 2: Generation of Wordplay Sequences ae.23 ao ea ei eo ene.23 ksh.11 lr.56 rm.44 rre.23 td.39 tth.32 tz.17 wm.44 wr.42 wwh.23
19
Step 2: Generation of Wordplay Sequences ae.23 ao ea ei eo ene.23 ksh.11 lr.56 rm.44 rre.23 td.39 tth.32 tz.17 wm.44 wr.42 wwh.23
20
Step 2: Generation of Wordplay Sequences ae.23 ao ea ei eo ene.23 ksh.11 lr.56 rm.44 rre.23 td.39 tth.32 tz.17 wm.44 wr.42 wwh.23
21
Step 2 :Generation of Wordplay Sequences ae.23 ao ea ei eo ene.23 ksh.11 lr.56 rm.44 rre.23 td.39 tth.32 tz.17 wm.44 wr.42 wwh.23
22
Step 2: Generation of Wordplay Sequences ae.23 ao ea ei eo ene.23 ksh.11 lr.56 rm.44 rre.23 td.39 tth.32 tz.17 wm.44 wr.42 wwh.23
23
Step 2: Generation of Wordplay Sequences ae.23 ao ea ei eo ene.23 ksh.11 lr.56 rm.44 rre.23 td.39 tth.32 tz.17 wm.44 wr.42 wwh.23
24
Step 2: Generation of Wordplay Sequences ae.23 ao ea ei eo ene.23 ksh.11 lr.56 rm.44 rre.23 td.39 tth.32 tz.17 wm.44 wr.42 wwh.23
25
Step 2: Generation of Wordplay Sequences ae.23 ao ea ei eo ene.23 ksh.11 lr.56 rm.44 rre.23 td.39 tth.32 tz.17 wm.44 wr.42 wwh.23
26
Step 2: Generation of Wordplay Sequences ae.23 ao ea ei eo ene.23 ksh.11 lr.56 rm.44 rre.23 td.39 tth.32 tz.17 wm.44 wr.42 wwh.23 Decomposition of whator is what or what or is different from water wordplay found; return what or
27
Step 3: Wordplay Validation Check if the wordplay is meaningful If wordplay is at least two words o Decompose wordplay into word pairs what or o Check if word pair in the bigram database no If wordplay is one word o The word is in the dictionary If wordplay is meaningful, Step 4. Otherwise, Step 2.
28
Step 2: Generation of Wordplay Sequences ae.23 ao ea ei eo ene.23 ksh.11 lr.56 rm.44 rre.23 td.39 tth.32 tz.17 wm.44 wr.42 wwh.23 Decomposition of whatare is what are what are is different from water wordplay found; return what are
29
Step 3: Wordplay Validation Check if the wordplay is meaningful If wordplay is at least two words o Decompose wordplay into word pairs what are o Check if word pair in the bigram database yes Proceed to Step 4.
30
Step 4: Last Sentence Validation with Wordplay Wordplay is meaningful Could occur In the beginning of last sentence: What are you doing? In the middle of last sentence: Please tell me what are you doing? At the end of last sentence The question started with “what are”.
31
Step 4: Last Sentence Validation with Wordplay In the beginning of last sentence: If wordplay is at least 2 words o What are you doing? o Check if (what are you) and (are you doing) are in trigram table. If wordplay is only one word o Meter you doing? o Check if (meter you doing) is in trigram table If at least one of the needed sequences in not in trigram table, Step 2. Otherwise, the text is a joke.
32
Step 4: Last Sentence Validation with Wordplay In the middle of last sentence: If wordplay is at least 2 words o Please tell me what are you doing? o Check if (tell me what), (me what are), (what are you) and (are you doing) are in trigram table. If wordplay is only one word o Please tell me meter you doing? o Check if (tell me meter) and (meter you doing) is in trigram table If at least one of the needed sequences in not in trigram table, Step 2. Otherwise, the text is a joke.
33
Step 4: Last Sentence Validation with Wordplay At the end of last sentence: If wordplay is at least 2 words o The sentence ended with what are? o Check if (ended with what) and (with what are) are in trigram table. If wordplay is only one word o The sentence ended with meter? o Check if (ended with meter) is in trigram table If at least one of the needed sequences in not in trigram table, Step 2. Otherwise, the text is a joke.
34
Results 66 training jokes 59 jokes were recognized 7 unrecognized, no wordplay found 66 non-jokes 62 correctly recognized as non-jokes 1 found wordplay that makes sense 3 incorrectly recognized as jokes 130 test jokes 8 jokes were not expected to be recognized 12 identified as jokes with expected wordplay 5 identified as jokes with unexpected wordplay 80 expected wordplay found
35
Possible Enhancements Improve last sentence validation Increasing size of text used for N-gram training Parser N-grams with stemming Improve wordplay generator Use of phoneme comparison Use wider domain All types of Knock Knock jokes Other types of wordplay jokes
36
Conclusion Initial investigation into computational humor recognition using wordplay The program was designed to Recognize wordplay in jokes 67% Recognize jokes with containing wordplay 12%
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.