{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/pun-generation-with-surprise","title":"Pun Generation with Surprise","arxiv_id":"1904.06828","date":"2019-04-15","proceeding":"NAACL 2019 6","authors":["He He","Nanyun Peng","Percy Liang"],"abstract":"We tackle the problem of generating a pun sentence given a pair of homophones\n(e.g., \"died\" and \"dyed\"). Supervised text generation is inappropriate due to\nthe lack of a large corpus of puns, and even if such a corpus existed, mimicry\nis at odds with generating novel content. In this paper, we propose an\nunsupervised approach to pun generation using a corpus of unhumorous text and\nwhat we call the local-global surprisal principle: we posit that in a pun\nsentence, there is a strong association between the pun word (e.g., \"dyed\") and\nthe distant context, as well as a strong association between the alternative\nword (e.g., \"died\") and the immediate context. This contrast creates surprise\nand thus humor. We instantiate this principle for pun generation in two ways:\n(i) as a measure based on the ratio of probabilities under a language model,\nand (ii) a retrieve-and-edit approach based on words suggested by a skip-gram\nmodel. Human evaluation shows that our retrieve-and-edit approach generates\npuns successfully 31% of the time, tripling the success rate of a neural\ngeneration baseline.","url_abs":"http://arxiv.org/abs/1904.06828v1","url_pdf":"http://arxiv.org/pdf/1904.06828v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"pun-generation-with-surprise","repo_url":"https://github.com/hhexiy/pungen","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"pun-generation-with-surprise","repo_url":"https://worksheets.codalab.org/worksheets/0x5a7d0fe35b144ad68998d74891a31ed6","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"none","reach":null}],"tasks":[{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"sentence","task_name":"Sentence"},{"task_slug":"text-generation","task_name":"Text Generation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1904.06828","mcp":null,"developers":"https://syntology.ai/developers"},"arxiv_metadata":null,"syntology_extracted_results":null}