A mbi P un: Generating Humorous Puns with Ambiguous Context (2022)

Abstract: In this paper, we propose a simple yet effective way to generate pun sentences that does not require any training on existing puns. Our approach is inspired by humor theories that ambiguity comes from the context rather than the pun word itself. Given a pair of definitions of a pun word, our model first produces a list of related concepts through a reverse dictionary. We then utilize one-shot GPT3 to generate context words and then generate puns incorporating context words from both concepts. Human evaluation shows that our method successfully generates pun 52% of the time, outperforming well-crafted baselines and the state-of-the-art models by a large margin.

## introduction computational humor has garnered interest in the nlp community @xcite @xcite @xcite . in this paper, we tackle the problem of generating homographic puns @xcite : two or more meanings of a word form an intended humorous effect. for example, the three puns listed in figure 1 exploit two contrasting meanings of the word sentence: 1) a grammatical string of words and 2) the punishment by a court assigned to a guilty person. due to the lack of sizeable training data, existing approaches are heavy-weighted in order to not rely on pun sentences for training. for example, @xcite train a constrained neural language model @xcite from a general text corpus and then use a joint decoding algorithm to promote puns. @xcite propose a local-global surprisal principle, and @xcite leverage the generative adversarial nets @xcite sense 1 definition a string of words that is complete in itself, typically containing a subject and predicate sense 2 definition (criminal law) a final judgment of guilty in a criminal case and the punishment that is imposed ours 1 the sentence is ungrammatical. the jury didn't hear it. ours 2 i'm sorry i said the sentence was too long but punishments are endless. ## methodology overview and motivation our input is the target pun word (p) and its two sense definitions (s 1 , s 2 ), and the output is a list of humorous punning sentences. we implement the ambiguity principle proposed in @xcite : a pun sentence should contain one or more context words corresponding to each of the two senses. 2 the overview of our approach is visualized in figure 2 . given s 1 and s 2 , we first use a reverse dictionary to generate a list of words that semantically match the query descriptions. we call them related words (section 2.1). however, those related words are synonyms of the pun word and are rarely observed as it is in humorous sentences. for example, for the sentence: "the judge has got a stutter. looks like i am not getting a sentence.", the word representing the first sense (i.e. a final judgment of guilty in a criminal case) is represented by judge, which could not be generated using the sense definition. considering such nuances, in section 2.2 we propose three different methods to obtain the context words. they are extractive, similarity, and generative based. finally, in section 2.3 and 2.4, we introduce a keyword-to-text generator to generate candidate sentences , and a humor classifier to rule out some of the non-pun sentences. final sentences are then randomly sampled for evaluation. all our training data is general, non-humorous corpus except for the humor classifier. ## the position of pun words as is mentioned in section 2.3, we play with the position of the pun word in the prompt given to the candidate sentence generation model. we try three variants by putting the target pun word at the start, in the middle, and at the end. for each variant, we ask mechanical turkers to judge if the given sentences are puns. again, each sentence is rated by three turkers and we take the majority answer if the workers disagree. results from this analysis can be seen in to verify such hypothesis, we also calculate the position of the pun words of 1,163 human written pun sentences from semeval 2017 task 7 and report the distribution in figure 3 in the appendix. the histogram corroborates with the human annotated samples in that both suggest that keeping the pun word at the end of the sentence generates funnier puns. theory of humor which says that the "joke" in a funny sentences some towards the end of the sentence @xcite validates our analysis. ## conclusion we propose a novel approach towards homographic puns generation. unlike previous works that are mathematically heavy, our approach is backed by the humor theory that ambiguity is achieved by the context. automatic and human evaluations show that our model ambipun outperforms the current state-of-the-art model by a large margin.