Automatic Joke Generation: Learning Humor from Examples

  • Thomas WintersEmail author
  • Vincent NysEmail author
  • Daniel De SchreyeEmail author
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10922)


Computational humor systems often employ explicit rules encoding assumptions about what constitutes a funny joke. This paper explores how a program can teach itself to generate jokes based on a corpus of rated example jokes. We implement a system called Generalized Analogy Generator (Gag) capable of generating jokes using the “I like my X like I like my Y, Z” template. We use established humor theory and extend computational humor concepts to allow the system to learn the structures of the given jokes and estimate how funny people might find specific instantiations of joke structures. We also implement a platform for the collection of jokes and their ratings, which are used for the training data and evaluation of the system. Since Gag uses generalized components and learns its own schemas, this program successfully generalizes the most well-known analogy generator in the computational humor field.


Computational humor Joke generation Analogy generation Machine learning Crowdsourcing 


  1. 1.
    Heate, B.: Google is looking to creative writers and comedians to help humanize assistant (2016).
  2. 2.
    Zwaag, G.V.D.: Apple zoekt een grappenmaker voor siri: heb jij genoeg humor om te helpen? (2016).
  3. 3.
    Ritchie, G.: The structure of forced reinterpretation jokes. In: Proceedings of April Fools’ Day Workshop on Computational Humour (TWLT 20), pp. 47–56, April 2002Google Scholar
  4. 4.
    Binsted, K., Bergen, B., Coulson, S., Nijholt, A., Stock, O., Strapparava, C., Ritchie, G., Manurung, R., Pain, H., Waller, A., O’Mara, D.: Computational humor. IEEE Intell. Syst. 21(2), 59–69 (2006)CrossRefGoogle Scholar
  5. 5.
    Binsted, K., Ritchie, G.: An implemented model of punning riddles. CoRR abs/cmp-lg/9406022 (1994)Google Scholar
  6. 6.
    Manurung, R., Ritchie, G., Pain, H., Waller, A., Mara, D., Black, R.: The construction of a pun generator for language skills development. Appl. Artif. Intell. 22(9), 841–869 (2008)CrossRefGoogle Scholar
  7. 7.
    Agustini, T., Manurung, R.: Automatic evaluation of punning riddle template extraction. In: ICCC, pp. 134–139 (2012)Google Scholar
  8. 8.
    Petrović, S., Matthews, D.: Unsupervised joke generation from big data. In: Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), Sofia, Bulgaria, pp. 228–232. Association for Computational Linguistics, August 2013Google Scholar
  9. 9.
    Kiddon, C., Brun, Y.: That’s what she said: double entendre identification. In: Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics (ACL), Portland, OR, USA, pp. 89–94, June 2011., ACM ID: 2002756
  10. 10.
    Mihalcea, R., Strapparava, C.: Making computers laugh: investigations in automatic humor recognition. In: HLT/EMNLP 2005, Human Language Technology Conference and Conference on Empirical Methods in Natural Language Processing, Proceedings of the Conference, 6–8 October 2005, Vancouver, British Columbia, Canada, pp. 531–538 (2005)Google Scholar
  11. 11.
    Stock, O., Strapparava, C.: Hahacronym: humorous agents for humorous acronyms. Humor-Int. J. Humor Res. 16(3), 297–314 (2003)Google Scholar
  12. 12.
    Venour, C.: The computational generation of a class of puns. Master’s thesis, Queen’s University, Kingston, Ontario (1999)Google Scholar
  13. 13.
    Valitutti, A., Toivonen, H., Doucet, A., Toivanen, J.M.: “Let everything turn well in your wife”: generation of adult humor using lexical constraints. In: ACL (2), pp. 243–248. The Association for Computer Linguistics (2013)Google Scholar
  14. 14.
    Chandrasekaran, A., Parikh, D., Bansal, M.: Punny captions: witty wordplay in image descriptions. CoRR abs/1704.08224 (2017)Google Scholar
  15. 15.
    Justin McKay, B.M.: Generation of idiom-based witticism to aid second language learning. In: Proceedings of April Fools’ Day Workshop on Computational Humour (TWLT 20), pp. 77–87, April 2002Google Scholar
  16. 16.
    Taylor, J.: Computational recognition of humor in a focused domain. University of Cincinnati (2004)Google Scholar
  17. 17.
    Shahaf, D., Horvitz, E., Mankoff, R.: Inside jokes: identifying humorous cartoon captions. In: Proceedings of the 21st ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD 2015, pp. 1065–1074. ACM, New York (2015)Google Scholar
  18. 18.
    Goldberg, K., Roeder, T., Gupta, D., Perkins, C.: Eigentaste: a constant time collaborative filtering algorithm. Inf. Retr. 4(2), 133–151 (2001)CrossRefGoogle Scholar
  19. 19.
    Karpathy, A., Johnson, J., Li, F.: Visualizing and understanding recurrent networks. CoRR abs/1506.02078 (2015)Google Scholar
  20. 20.
    Karpathy, A.: The unreasonable effectiveness of recurrent neural networks (2015).
  21. 21.
    Pilato, G., Augello, A., Vassallo, G., Gaglio, S.: EHeBby: an evocative humorist chat-bot. Mob. Inf. Syst. 4(3), 165–181 (2008)Google Scholar
  22. 22.
    Lessard, G., Levison, M.: Computational modelling of linguistic humour, Tom Swifties. In: ALLClACIi92 Conference Abstracts, pp. 175–178 (1992)Google Scholar
  23. 23.
    Raskin, V., Attardo, S.: Non-literalness and non-bona-fîde in language: an approach to formal and computational treatments of humor. Pragmat. Cogn. 2(1), 31–69 (1994)CrossRefGoogle Scholar
  24. 24.
    Hong, B.A., Ong, E.: Automatically extracting word relationships as templates for pun generation. In: Proceedings of the Workshop on Computational Approaches to Linguistic Creativity, CALC 2009, Stroudsburg, PA, USA, pp. 24–31. Association for Computational Linguistics (2009)Google Scholar
  25. 25.
    Miller, G.A.: WordNet: a lexical database for English. Commun. ACM 38(11), 39–41 (1995)CrossRefGoogle Scholar
  26. 26.
    Krikmann, A.: Contemporary linguistic theories of humour. Folk. Electron. J. Folk. 33, 27–58 (2006)CrossRefGoogle Scholar
  27. 27.
    Mulder, M., Nijholt, A.: Humour research: state of art. Technical Report CTIT-02-34, September 2002Google Scholar
  28. 28.
    Waller, A., Black, R., Mara, D.A., Pain, H., Ritchie, G., Manurung, R.: Evaluating the STANDUP pun generating software with children with cerebral palsy. ACM Trans. Access. Comput. (TACCESS) 1(3), 1–27 (2009)CrossRefGoogle Scholar
  29. 29.
    Ritchie, G.: Developing the incongruity-resolution theory. In: AISB Symposium on Creative Language: Stories and Humour, Edinburgh, UK, pp. 78–85, April 1999Google Scholar
  30. 30.
    Fellbaum, C. (ed.): WordNet: An Electronic Lexical Database, vol. 69. University of Chicago Press, Chicago (1999)zbMATHGoogle Scholar
  31. 31.
    Breiman, L.: Random forests. Mach. Learn. 45(1), 5–32 (2001)CrossRefGoogle Scholar

Copyright information

© Springer International Publishing AG, part of Springer Nature 2018

Authors and Affiliations

  1. 1.KU LeuvenLeuvenBelgium

Personalised recommendations