Automating the Detection of Poetic Features: The Limerick as Model Organism (2021)

Abstract: In this paper we take up the problem of “limerick detection” and describe a system to identify five-line poems as limericks or not. This turns out to be a surprisingly difficult challenge with many subtleties. More precisely, we produce an algorithm which focuses on the structural aspects of the limerick – rhyme scheme and rhythm (i.e., stress patterns) – and when tested on a a culled data set of 98,454 publicly available limericks, our “limerick filter” accepts 67% as limericks. The primary failure of our filter is on the detection of “non-standard” rhymes, which we highlight as an outstanding challenge in computational poetics. Our accent detection algorithm proves to be very robust. Our main contributions are (1) a novel rhyme detection algorithm that works on English words including rare proper nouns and made-up words (and thus, words not in the widely used CMUDict database); (2) a novel rhythm-identifying heuristic that is robust to language noise at moderate levels and comparable in accuracy to state-of-the-art scansion algorithms. As a third significant contribution (3) we make publicly available a large corpus of limericks that includes tags of “limerick” or “not-limerick” as determined by our identification software, thereby providing a benchmark for the community. The poetic tasks that we have identified as challenges for machines suggest that the limerick is a useful “model organism” for the study of machine capabilities in poetry and more broadly literature and language. We include a list of open challenges as well. Generally, we anticipate that this work will provide useful material and benchmarks for future explorations in the field.

## introduction the application of natural language processing methods to the field of poetry and poetics has led to much promising work. in particular, advances in machine learning-based language models have spurred investigations into various kinds of automated poetic analysis and synthesis. there has been recent work pursuing automated scansion ("scansion" denoting the marking of feet, accents, and caesuras or pauses in lines of poetry) @xcite @xcite @xcite @xcite and probing the ability of language models to encode rhyme @xcite . other work is devoted to the automatic classification of poetic kinds, like the haiku in english @xcite and free verse @xcite . on the generative or machine writing side of the problem, models have been trained to output synthetic poems that are increasingly difficult to tell apart from human-made poetic compositions; such work includes the generation of sonnets @xcite and, especially relevant to the present paper, limericks @xcite . these computational approaches to poet-ics share many of the same objects of inquiry as recent scholarship in literary criticism, especially those associated with the "new formalism" and "historical poetics" @xcite @xcite . such scholarship and computational poetics together prompt us to attend once again to the particularities of poetic form -meter and rhythm, poetic sound generally, aspects of lyric poetry, and related concerns. this kind of joined work promises to advance our understanding of the formal elements of poetry while also making progress in our understanding of the capabilities of language models to gain what might be called poetic knowledge. in this paper we hope to contribute to computational poetics and formalist literary criticism alike by offering an account of our work in the automatic detection of poetic features, using the limerick form. the limerick is a comedic, light, and primarily oral poetic kind. while there is but a scattering of scholarship on the genre (see e.g., @xcite @xcite @xcite ) there are nevertheless important reasons to take up the limerick. state-of-the-art language models still tend to perform better with short texts @xcite , and the limerick is a short verse form. even better, limericks have a high density of conspicuous poetic-formal features compared to other short verse forms @xcite . haiku, for example, do not have rhymes or consistent accentual patterning, and epigrammatic couplets are less interesting than limericks in terms of rhyme scheme and rhythmic variation between lines. for these reasons, the limerick is a particularly promising case study for computational poetics. in biological terms, it is a useful model organism, an object of study tactically chosen for its relative simplicity and potential to provide insights into broader phenomena @xcite -in our case, poetry more broadly. specifically, with this paper we offer the following. first, a large, clean limerick data set as a resource to other researchers: wang et. al, noting the unavailability of large limerick data sets, have offered a novel corpus of their own, made up of 2,000 limericks @xcite we offer a data set of 98,454 highly regular limericks drawn from the the omnificent english dictionary in limerick form ("oedilf") website. second, we outline our methods for detecting two of the three main features of limericks: their rhyme scheme and ac-centual pattern. (we discuss the third feature of the limerick, its triplet meter, which is closely related to its accentual pattern, in our "future directions" section.) the "limerick decision" problem, of deciding whether or not a poem is a limerick through the automatic discernment of formal features, may appear to be of only narrow interest. but, as per the model organism conceit we see it as not only enabling the construction of a well-defined poetic, even literary laboratory, but also as a direct pathway to a range of broader potential applications for computational poetics and formal feature detection. these include the automated discernment of latent poetic features of songs, advertising and marketing copy, political speeches, and more. we take this up in the concluding "future directions" section. the case or model organism of the limerick has implications that reach well beyond the form itself. ## recognizing the limerick according to the new princeton encyclopedia of poetry and poetics the limerick is "the most popular form of comic, light verse in english." the origins of the form and its very name "limerick" are obscure, but the form was popularized by edward lear's a book of nonsense (1846) and became widespread by the early 20th century @xcite . the limerick form has three main formal features: rhyme scheme. the limerick's rhyme scheme is aabba. in written form, limericks are almost always arranged as five-line poems, but it is also possible to view the limerick as a four-line poem by combining the third and fourth lines as a pair of hemistichs (half-lines of verse) that are separated by a caesura (a pause). it is even possible to understand the limerick as comprised of two long verse lines, the first (merging lines 1 and 2) having six accents and the second (merging lines 3-5) having seven accents. @xcite . whatever its written form, all recited limericks conform aurally to the aabba rhyme scheme. ## data we scraped from the website the omnificent english dictionary in limerick form ("oedilf"). the oedilf, established in 2004, is an amateur, crowd-sourced project whose goal is to have at least one limerick for every meaning of every word found in the oxford english dictionary. usersubmitted limericks are subject to approval by moderators, and, if approved, are published on the website. 1 we turned to oedilf in order to get a large number of limericks which we could then sort according to different categories of metadata. foot_1 at the time of writing this paper, oedilf contained 112,609 submitted limericks, of which 110,610 were approved and posted to the site. on the website, the limericks are organized according to different categories: authors. our scrape of oedilf contains limericks by 1624 unique authors. the distribution of limericks by author is not uniform (figure 1 ), with the top ten authors responsible for ca. 40% of all limericks. topics. the topics are generated by the contributors to the website as well as by the moderators. words. oedilf is interested in words as found in the dictionary, as described above. the website allows users to search limericks by keywords: for instance, there are 52 limericks featuring the word, "bridge," spanning its denotations as card game, infrastructure, a platform found on vessels, segment of a pop song, and so on. currently, oedilf is focusing on words beginning with the letters "aa-" through "ha-," and indicates the projected date of completion (presumably having a limerick for every meaning of every word found in the oed) as november 3, 2063. 3 for our detection experiments below, we first filtered limericks based on simple criteria: limericks must have 5 lines and must use words (as opposed to symbols, such as emojis or formulae). this excludes a range of unorthodox limericks such as ascii art limericks. the result was a corpus of 98,454 limericks, dated 1998 to the present. ## results after applying all of our rhyming and meter filters we identify a final clean set of 65,971 limericks, which constitutes 67% of our original set of limericks that we scraped ( one implication of our results is that in the limerick form, at least as understood by the poetizing users and editors of oedilf, accentual pattern predominates as a necessary formal trait. 95% of the limericks in the data set satisfied our accent measure, and 70% cleared our rhyme filter. ideally, a poem is an "organic whole" @xcite with its different formal features and the work's meaning working harmoniously together. yet our findings suggest that, practically speaking, there is a hierarchy of formal features. all formal features are not emphasized equally by writers and readers of poems: some features matter more than others in the quiddity of the form -in the limerick-ness of the limerick. another way to put this is that we (humans) have laxer expectations about some formal elements of poems (like syllables), a higher toleration for variation among these elements while still identifying the work as an instance of the poetic kind. (for example, a sonnet with 13 lines may seem less like sonnet than a sonnet whose rhyme scheme is slightly aberrant: in other words, in practice, the number of lines is a more essential feature of the sonnet than strict adherence to the rhyme scheme.) ## difficult examples the previous subsections take the limerick and break out fundamental structural components that need to be identified for limerick detection. that said, the human -poet or not -can readily create new difficult limericks that might defeat these state-of-the-art poetic classification engines. we tested our rhyme detection and accent detection algorithms on the following poems 8 with made-up words for end rhymes. these are words that are definitely not included in cmudict. our rhyme and accent detectors both correctly evaluated these examples, accepting all three limericks as featuring legitimate limerick rhyme schemes and stress patterns. my favorite food is red schnook, it is best when eaten with glook, or with sauce from meef, or with sides of dreef, it always makes me feel so trook. i like to walk in the dark fraze, at my side a furry brown braze, it lopes on its broops, and shakes his sharp croops, that stir up the hidden small snays. it's so tough to fagrewzin a kloom, its frantabulous frinks are a croom, to brillig the shneezles, or traming the dreaszels, the sturmping coughs up shnayble and stoom. ## future directions as mentioned, in this paper we have only addressed the problem of the structural identification of the 8 all three poems were written by one of the authors of this paper. limerick. but, of course there is much more to the limerick than just patterns of rhyme and rhythm. the limerick is typically a narrative. these brief, comic stories fall into different narrative types and structures. for example, consider the paired examples below: the one on the right ("old man with a beard") exhibits a more linear or teleological structure, while the one on the left ("old person of dean") 9 is circular in that it ends with a return to the first line, thereby resembling the refrains found in ballads and villanelles: there was an old man with a beard, who said, 'it is just as i feared! two owls and a hen, four larks and a wren, have all built their nests in my beard!' there was an old person of dean, who dined on one pea and one bean; for he said, "more than that would make me too fat," that cautious old person of dean. thus the narrative aspects of limericks warrant further study, including their narrative structure, punchlines and jokes (which can range from the subtle to the vulgar), twists in the story, and more. a related feature of limericks is their semantic integrity: despite the limerick form's association with nonsense verse because of edward lear's a book of nonsense and their oftentimes silly content, good limericks still make sense, cohere, and have aesthetic qualities that can be appreciated. for example, can a machine discern that the limerick immediately below foot_7 is more successful than the one below it foot_8 because of the latter's non-sequitur conclusion? moreover, can it readily detect the non-sequitur? there was an old man in a tree, who was horribly bored by a bee; when they said, 'does it buzz?' he replied, 'yes, it does!' 'it's a very regular brute of a bee!' filter statistics original data set rhyming rhythm 98454 69446 (0.70) 93681 (0.95) original data set rhyme & rhythm 98454 65971 (0.67) there was an old man with a beard, who said, "it is just as i feared! two owls and a hen, four larks and a wren, and mutton is best boiled, not seared. a third potential area of investigation is wordplay, some of which depends on poetic devices such as assonance, alliteration, and puns and innuendo. the problem of machine recognition and subsequent classification of such literary devices pose interesting challenges for a next generation of machine limerick readers. the long range goals we mention above -indeed the entire setting of this work -places these kinds of investigations and challenges within the context of machine learning and language and thus, broadly in the space of natural language processing (nlp). in that setting, there is a strong thread of work focused on probing the linguistic knowledge of the increasingly complex language models (e.g., transformer-based deep learning architectures). of interest are the "minimal pair" challenges in which the architecture is "asked" -after suitable training -to assign a likelihood of correctness (in the sense of a model's "preference") between an original and presumably correct instance of some phenomenon and a minimally corrupted (relative to a given grammatical rule) version as evidence of some ability to distinguish a particular linguistic characteristic. in @xcite 12 kinds of phenomena are investigated and each phenomenon is further deconstructed into "paradigms" and paradigm is the source of 1000 instances of minimal pairs. foot_9 this minimal pairs approach is being extended to poetic devices -specifically, in the investigation of language models to encode rhyming information @xcite . one extension of this work would be the comparison of a "correct" lim-erick and a variation minimally corrupted in terms of meter or rhyme scheme to test the poetic knowledge in language models and whose results will produce benchmarks (and a fixed test set) for the deep learning community. it is our general sense that poetic knowledge is a challenging domain that productively probes the linguistic capabilities of advanced language models. moreover, we could well imagine an even broader set of minimal pair benchmarks to interrogate the "writerly" or "stylistic" knowledge of language models. it is also possible to envision applications for language models that possess poetic knowledge. as roman jakobson showed, political slogans (like "i like ike") can have rich aural, orthographic, and rhythmic patterning which augment their catchiness @xcite . such poetic knowledge could extend to the large scale analysis of popular music, advertising and marketing copy, and perhaps even political speeches, propaganda, and disinformation -all with an eye toward examining what makes certain non-poetic instances of language which are nevertheless suffused with poetic features so effective or memorable to large audiences. at its most speculative, this kind of work trains an odd light on the seemingly impenetrable process of how we learn to write even the simplest forms of poetry like the limerick. a young child learns to rhyme, decide syllable breaks, and can develop a sense of poetic meter very quickly -say, in a single grade school class (if the plethora of teachers' worksheets available on the internet is any indication). that a language model with billions of parameters and thousands of examples isn't yet perfect says a lot about both the models we develop and the human process of learning as well.