260 likes | 861 Vues
Opening Computational Door on Knock Knock Jokes. Julia M. Taylor & Lawrence J. Mazlack Applied Artificial Intelligence Laboratory University of Cincinnati. Introduction. This is an initial investigation into computational humor recognition using wordplay The program
E N D
Opening Computational Door on Knock Knock Jokes Julia M. Taylor & Lawrence J. Mazlack Applied Artificial Intelligence Laboratory University of Cincinnati
Introduction • This is an initial investigation into computational humor recognition using wordplay • The program • Learns statistical patterns of text • Recognizes utterances similar in pronunciation to a given word • Determines if found utterances transform a text into a joke
Restricted Domain: Knock Knock Jokes • Line1: “Knock, Knock” • Line2: “Who’s there?” • Line3: any phrase • Line4: Line3 followed by “who?” • Line5: One or several sentences containing • Type1: Line3 • Type2: A wordplay on Line3 • Type3: A meaningful response to a wordplay of Line3 or Line4
Restricted Domain: Knock Knock Jokes • Type1: Line3 --Knock, Knock --Who’s there? --Water --Water who? --Water you doing tonight? • Type2: A wordplay on Line3 --Knock, Knock --Who’s there? --Ashley --Ashley who? --Actually, I don’t know. • Type3: A meaningful response to a wordplay of Line4 --Knock, Knock --Who’s there? --Tank --Tank who? --You are welcome.
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
Similarity Table • Contains combination of letters that sound similar • Based on similarity table of cross-referenced English consonant pairs • Modified by: • translating phonemes to letters • adding vowels that are close in sound • adding other combinations of letters that may be used to recognize wordplay Segment of similarity table
Training Corpus • Training texts were entered into N-gram database Nurse: I need to get your weight today. Impatient patient: 3 hours and 45 minutes. • Wordplay validation: bigram table (I need 1) (need to 1) (to get 1) (get your 1) (your weight 1) (weight today 1) (today end-of-sentence 1) • Punchline validation: trigram table (I need to 1) (need to get 1) (to get your 1) (get your weight 1) (your weight today 1) (weight todayend-of-sentence1)
How It Works • Step1: joke format validation • Step2: computational generation of sound-alike sequences • Step3: validations of a chosen sound-alike sequence • Step4: last sentence validation with sound-alike sequence
Step 1: Joke Format Validation • Line1: “Knock, Knock” • Line2: “Who’s there?” • Line3: any phrase • Line4: Line3 followed by “who?” • Line5: One or several sentences containing Line3 • Knock, Knock • Who is there? • I, Felix • I, Felix who? • I, Felix-ited! • Knock, Knock • Who is there? • I, Felix • I, Felix who? • I feelexcited!
Step 2: Generation of Wordplay Sequences • Repetitive letter replacements of Line3 • 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 Segment of similarity table
Step 2: Generation of Wordplay Sequences ifelixited 10.0 efelixited 9.23
Step 2: Generation of Wordplay Sequences ifelixited 10.0 efelixited 9.23 ifilixited 9.23 ifalixited 9.23 ifolixited 9.23
Step 2: Generation of Wordplay Sequences ifelixited 10.0 efelixited 9.23 ifilixited 9.23 ifalixited 9.23 ifolixited 9.23 iferixited 9.56
Step 2: Generation of Wordplay Sequences ifelixited 10.0 efelixited 9.23 ifilixited 9.23 iferixited 9.56 ifolixited 9.23 ifalixited 9.23
Step 2: Generation of Wordplay Sequences ifelixited 10.0 iferixited 9.56 ifilixited 9.23 efelixited 9.23 ifolixited 9.23 ifalixited 9.23
Step 2: Generation of Wordplay Sequences if el exited ifelexited 9.23 *** *** *** ***
Step 3: Wordplay Validation if el exited NO one word? YES divide into pairs if el el exited each pair in bigram? NO YES Step 2 Step 4
Step 2: Generation of Wordplay Sequences i feel excited ifeelexcited 7.x *** *** *** ***
Step 3: Wordplay Validation i feel excited NO one word? YES divide into pairs I feel feel excited each pair in bigram? NO YES Step 2 Step 4
Step 4: Last SentenceValidation with Wordplay • Wordplay is meaningful • Could occur • In the beginning of last sentence • In the middle of last sentence • At the end of last sentence
Step 4: Last Sentence Validation with Wordplay • In the beginning of sentence: i feel excited (wordplay N, punch1, punch2) in trigram? NO YES One word? YES NO (wordplay N-1, wordplay N, punch1) in trigram? NO YES Step 2 joke Step 2
Step 4: Last Sentence Generation with Wordplay • In the beginning of sentence: i feel excited Is there sentence in the training text with wordplay? NO YES Step 2 joke
Knock Knock Joke Generation --Knock, Knock --Who’s there? --Ammonia --Ammonia who? --Ammonia … Ammonia = I’m only • --Knock, Knock • --Who’s there? • --Ammonia • --Ammonia who? • --Ammonia trying to be funny
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 wordplays found
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
Conclusion • Initial investigation into KK joke recognition using wordplay • The program was designed to • Recognize wordplay in KK jokes 67% • Recognize KK jokes containing wordplay 12% • Alternate result of this program • KK joke generator