  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 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 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.
