Context-Situated Pun Generation (2022)

Abstract: Previous work on pun generation commonly begins with a given pun word (a pair of homophones for heterographic pun generation and a polyseme for homographic pun generation) and seeks to generate an appropriate pun. While this may enable efficient pun generation, we believe that a pun is most entertaining if it fits appropriately within a given context, e.g., a given situation or dialogue. In this work, we propose a new task, context-situated pun generation, where a specific context represented by a set of keywords is provided, and the task is to first identify suitable pun words that are appropriate for the context, then generate puns based on the context keywords and the identified pun words. We collect a new dataset, CUP (Context-sitUated Pun), containing 4.5k tuples of context words and pun pairs. Based on the new data and setup, we propose a pipeline system for context-situated pun generation, including a pun word retrieval module that identifies suitable pun words for a given context, and a pun generation module that generates puns from context keywords and pun words. Human evaluation shows that 69% of our top retrieved pun words can be used to generate context-situated puns, and our generation module yields successful puns 31% of the time given a plausible tuple of context words and pun pair, almost tripling the yield of a state-of-the-art pun generation model. With an end-to-end evaluation, our pipeline system with the top-1 retrieved pun pair for a given context can generate successful puns 40% of the time, better than all other modeling variations but 32% lower than the human success rate. This highlights the difficulty of the task, and encourages more research in this direction.

## introduction pun generation is a challenging creative generation task that has attracted some recent attention in the research community @xcite figure 1 : context-situated pun generation aims to find relevant pun words to generate puns within a given context. we propose a unified framework to generate both homographic and heterographic puns; examples shown here are human-written puns from our corpus. @xcite @xcite . as one of the most important ways to communicate humor @xcite , puns can help relieve anxiety, avoid painful feelings and facilitate learning @xcite . at the same time, spontaneity is the twin concept of creativity @xcite , which means the context matters greatly for making an appropriate and funny pun. existing work on pun generation mainly focuses on generating puns given a pair of pun-alternative words or senses (we call it a pun pair). specifically, in heterographic pun generation, systems generate puns using a pair of homophones involving a pun word and an alternative word @xcite @xcite . alternatively, in homographic pun generation, systems generate puns that must support both given senses of a single polysemous word @xcite @xcite . despite the great progress that has been made under such experimental settings, real-world applications for pun generation (e.g., in dialogue systems or creative slogan generation) rarely have these pun pairs provided. instead, puns need to be generated given a more naturally-occurring conversational or creative context, requiring the identification of a pun pair that is relevant and appropriate for that context. for example, given a conversation turn "how was the magic show?", a context-situated pun response might be, "the magician got so mad he pulled his hare out." motivated by real-world applications and the theory that the funniness of a pun heavily relies on the context, we formally define and introduce a new setting for pun generation, which we call context-situated pun generation: given a context represented by a set of keywords, the task is to generate puns that fit the given context (figure 1 ). our contributions are as follows: formulation. given the unified representation for heterographic and homographic puns, we define the task of context-situated pun generation as: given a context c, which can be a sentence or a list of keywords, find a pun pair (p w , s pw , a w , s aw ) that is suitable to generate a pun, then generate a pun using the chosen pun pair situated in the given context. in this work, we assume we are given a fixed set of pun pair candidates (p w , a w ) from which (p w , a w ) are retrieved. the unified format between heterographic and heterographic puns makes it possible for us to propose a unified framework for pun generation. pw / aw l context-situated pun for hunts, deer hedges/ edges 1 why is the hunter so good at hunting deer? because he hunts life on the hedges husky/husk 0 catch/ catch 1 he hunts deer but the catch is that they rarely show up. pine/ pine 1 hunting deer in the forest always makes him pine for the loss. boar/ bore 1 he is so mundane about hunting deer, but it is hardly a boar. jerky/ jerky 1 what do you call an erratic deer that is being hunted? jerky ## cup dataset motivation. the largest and most commonlyused dataset in the pun generation community is the semeval 2017 task 7 dataset @xcite . 2 under our setting of context-situated pun generation, we can utilize keywords from the puns themselves as context. however, the majority of pun pairs only occur once in the the semeval dataset, while one given context could have been compatible with many other pun pairs. for example, given the context beauty school, class, the original pun in the semeval dataset uses the homographic pun pair (makeup, makeup) and says: "if you miss a class at beauty school you'll need a makeup session." at the same time, a creative human can use the heterographic pun pair (dyed, die) to instead generate "i inhaled so much ash from the eye shadow palette at the beauty school class -i might have dyed a little inside." because of the limitation of the semeval dataset, we need a dataset that has a diverse set of pun pairs combined with given contexts. furthermore, the dataset should be annotated to indicate whether the context words and pun pair combination is suitable to make context-situated puns. ## context-situated pun generation we propose a pipeline framework to generate context-situated puns, shown in figure 2 . it consists of: (i) a retrieval-based module that selects a set of relevant pun word pairs, and (ii) a generation module that takes the context words and retrieved pun word pairs as input to generate puns. in this section, we briefly describe each component. pun word pair retrieval. we propose a retrieve-and-rank strategy to select k relevant pun word pairs (p w , a w ) from a large, fixed set of pun word pairs (p w , a w ) for a given context c. c should be a list of keywords describing the context. if the context is given as a sentence, we use rake @xcite to automatically extract a list of keywords from the context to construct c. for each context c, we apply a classifier to all available pun word pairs in our data (p w , a w ) and retrieve pairs classified as suitable. then, we rank the suitable instances according to the model's confidence and take the top k instances as the final retrieved (p w , a w ) pun word pairs. we experiment with both supervised and unsupervised approaches to build the retrieval module in section 5.1. pun generation. given pun word pair (p w , a w ), pun word senses s pw and s aw , and context c, the pun generation module generates puns that relate to c, incorporate pun word p w , and embody the meanings s pw and s aw of the pun word pair. since there are limited pun datasets available for model training, we adopt a two-stage strategy that involves pretraining a t5-base @xcite ) model on non-pun text to learn to incorporate words and their senses in generations, then finetuning the model on pun data to learn the structure of puns. we describe our pun generation models in section 5.2. ## experiments we design our experiments to answer the following three research questions: q1. what is the performance of the pun word pair retrieval module? (section 5.1) q2. what is the performance of the pun generation module? is the pretraining stage necessary? (section 5.2) q3. how well does the pipeline system perform in an end-to-end evaluation? is the context-situated pun generation task plausible for humans? (section 5.3) ## conclusion and future work we propose a new setting for pun generation: context-situated pun generation. as a pioneering work, to facilitate future research in this direction, we first collect a large-scale corpus, cup, which contains 4,551 annotated context and pun word pairs annotated for compatibility, along with 2,753 human-written puns for the compatible pairs, which is of an even larger size than the current most commonly-used pun dataset, semeval 2017 task 7 @xcite . to benchmark the performance of the state-of-the-art nlg techniques on the proposed task, we build a pipeline system composed of a pun pair retrieval module that identifies suitable pun pairs for a given context, and a generation module that generates context-situated puns given the context and compatible pun pairs. human evaluation shows that the best model achieves 40% success rate in end-to-end evaluation, trailing behind human performance by almost 32%, highlighting the challenge of the task and encouraging more future work in this direction. our work introduces the concept of situating in context to pun generation. however, future work can easily extend the idea and framework to other areas of creative generation, such as metaphor generation, lyric generation, and others. another promising future direction is to integrate the generated puns into the original conversational or situational context to improve the interestingness and engagingness of the downstream applications. we hope our work can inspire more innovations on context-situated creative generation.