An Expert System for the Composition of Formal Spanish Poetry Pablo Gervás Universidad Europea - CEES, Madrid pg2@dinar.esi.uem.es www.uem.esi.es/~pg2 Abstract: The present paper presents an application that composes formal poetry in Spanish in a semiautomatic interactive fashion. ASPERA is a forward reasoning rule- based system that obtains from the user basic style parameters and an intended message; applies a knowledge-based preprocessor to select the most appropriate metric structure for the user's wishes; and, by intelligent adaptation of selected examples from a corpus of verses, carries out a prose-to- poetry translation of the given message. In the composition process, ASPERA combines natural language generation and CBR techniques to apply a set of construction heuristics obtained from formal literature on Spanish poetry. If the user validates the poem draft presented by the system, the resulting verses are analysed and incorporated into the system data files. 1. Introduction The automatic generation of text is a well established and promising problem in AI, with numerous practical applications waiting in the sidelines for efficient and acceptable solutions. Existing systems have shown reasonable results in restricted domains [3,7,9], opening the way to considering how more elaborate texts - from the point of view of aesthetics and reader satisfaction - can be obtained [2,4,8]. The composition of poetry ranks among the most challenging problems of language generation, and is therefore a good testbed for techniques designed to improve the quality of generated texts. ASPERA (Automatic Spanish Poetry Expert and Rewriting Application) is a prose-to-poetry semiautomatic translator. By ingenious use of well accepted AI techniques (Natural Language Processing, Case Based Reasoning, Knowledge Based Systems), the application obtains from the user a prose description of the intended message and a rough specification of the type of poem required (length, mood, topic); selects appropriate metre and stanza (by resorting to a knowledge base on literary style); generates a draft of the poem (by applying CBR techniques to a database of previous poems); requests modification or validation of the draft by the user; and updates its own database of information (using NLP techniques to extract all the required linguistic information from the