Automatic Poetry Generation from Prosaic Text (2020)

Abstract: In the last few years, a number of successful approaches have emerged that are able to adequately model various aspects of natural language. In particular, language models based on neural networks have improved the state of the art with regard to predictive language modeling, while topic models are successful at capturing clear-cut, semantic dimensions. In this paper, we will explore how these approaches can be adapted and combined to model the linguistic and literary aspects needed for poetry generation. The system is exclusively trained on standard, non-poetic text, and its output is constrained in order to confer a poetic character to the generated verse. The framework is applied to the generation of poems in both English and French, and is equally evaluated for both languages. Even though it only uses standard, non-poetic text as input, the system yields state of the art results for poetry generation.

## introduction automatic poetry generation is a challenging task for a computational system. for a poem to be meaningful, both linguistic and literary aspects need to be taken into account. first of all, a poetry generation system needs to properly model language phenomena, such as syntactic well-formedness and topical coherence. furthermore, the system needs to incorporate various constraints (such as form and rhyme) that are related to a particular poetic genre. and finally, the system needs to exhibit a certain amount of literary creativity, which makes the poem interesting and worthwhile to read. in recent years, a number of fruitful nlp approaches have emerged that are able to adequately model various aspects of natural language. in particular, neural network language models have improved the state of the art in language modeling, while topic models are successful at capturing clearcut, semantic dimensions. in this paper, we explore how these approaches can be adapted and combined in order to model both the linguistic and literary aspects that are required for poetry generation. more specifically, we make use of recurrent neural networks in an encoder-decoder configuration. the encoder first constructs a representation of an entire sentence by sequentially incorporating each word of the sentence into a fixed-size hidden state vector. the final representation is then given to the decoder, which emits a sequence of words according to a probability distribution derived from the hidden state of the input sentence. by training the network to predict the next sentence with the current sentence as input, the network learns to generate plain text with a certain discourse coherence. by modifying the probability distribution yielded by the decoder, we enforce the incorporation of poetic constraints, such that the network can be exploited for the generation of poetic verse. it is important to note that the poetry system is not trained on poetic texts; rather, the system is trained on a corpus of standard, prosaic texts extracted from the web, and it will be the constraints applied to the network's probability distribution that confer a poetic character to the generated verse. the rest of this article is structured as follows. in section 2, we present an overview of related work on automatic poetry generation. section 3 describes the different components of our model. in section 4, we present an extensive human evaluation of our model, as well as a number of examples generated by the system. section 5, then, concludes and discusses some future research directions. ## related work early computational implementations that go beyond mere mechanical creativity have often relied on rule-based or template-based methods. one of the first examples is the aspera system @xcite for spanish, which relies on a complex knowledge base, a set of rules, and case-based reasoning. other approaches include @xcite , which combines rule-based generation with genetic algorithms, gonçalo oliveira (2012)'s poetryme generation system, which relies on chart generation and various optimization strategies, and @xcite , which exploits metaphorical expressions using a pattern-based approach. whereas poetry generation with rule-based and template-based models has an inherent tendency to be somewhat rigid in structure, advances in statistical methods for language generation have opened up new avenues for a more varied and heterogeneous approach to creative language generation. @xcite , for example, use an n-gram language model in combination with a rhythmic model implemented with finite-state transducers. and more recently, recurrent neural networks (rnns) have been exploited for poetry generation; zhang and lapata (2014) use an encoder-decoder rnn for chinese poetry generation, in which one rnn builds up a hidden representation of the current line in a poem, and another rnn predicts the next line word by word, based on the hidden representation of the current line. the system is trained on a corpus of chinese poems. @xcite tries to improve upon the encoderdecoder approach by incorporating a method of iterative improvement: the network constructs a candidate poem in each iteration, and the representation of the former iteration is used in the creation of the next one. and @xcite extend the method using an attention mechanism. @xcite combine rnns (for syntactic fluency) with distributional similarity (for the modeling of semantic coherence) and finite state automata (for imposing literary constraints such as meter and rhyme). their system, hafez, is able to produce well-formed poems with a reasonable degree of semantic coherence, based on a userdefined topic. @xcite focus on rhythmic verse; they combine an rnn, trained on a phonetic representation of poems, with a cascade of weighted finite state transducers. @xcite present a joint neural network model for the generation of sonnets, called deep-speare, that incorporates the training of rhyme and rhythm into the neural network; the network learns iambic stress patterns from data, while rhyming word pairs are separated from non-rhyming ones using a marginbased loss. and a number of recent papers extend neural poetry generation for chinese with various improvements, such as unsupervised style disentanglement @xcite , reinforcement learning @xcite , and rhetorical control @xcite . note that all existing statistical models are trained on or otherwise make use of a corpus of poetry; to our knowledge, our system is the first to generate poetry with a model that is exclusively trained on a generic corpus, which means the poetic character is endowed by the model itself. secondly, we make use of a latent semantic model in order to model topical coherence, which is equally novel. ## conclusion we presented a system for automatic poetry generation that is trained exclusively on standard, nonpoetic text. the system uses a recurrent neural encoder-decoder architecture in order to generate candidate verses, incorporating poetic and topical constraints by modifying the output probability distribution of the neural network. the best verse is then selected for inclusion in the poem, using a global optimization framework. we trained the system on both english and french, and equally carried out a human evaluation for both languages. the results indicate that the system is able to generate credible poetry, that scores well with regard to fluency and coherence, as well as meaningfulness and poeticness. compared to previous systems, our model achieves state of the art performance, even though it is trained on standard, non-poetic text. in our best setup, about half of the generated poems are judged to be written by a human. we conclude with a number of future research avenues. first of all, we would like to experiment with different neural network architectures. specifically, we believe hierarchical approaches @xcite as well as the transformer network @xcite would be particularly suitable to poetry generation. secondly, we would like to incorporate further poetic devices, especially those based on meaning. gripping poetry often relies on figurative language use, such as symbolism and metaphor. a successful incorporation of such devices would mean a significant step towards truly inspired poetry generation. and finally, we would like to adapt the model for automatic poetry translation-as we feel that the constraint-based approach lends itself perfectly to a poetry translation model that is able to adhere to an original poem in both form and meaning. in order to facilitate reproduction of the results and encourage further research, the poetry generation system is made available as open source software. the current version can be downloaded at https://github.com/timvdc/poetry .