Computational Creativity
Poetry Generator – A Journey in Computational Creativity
This project explores the creative potential of artificial intelligence in the realm of poetry. Inspired by the lyrical simplicity of W. B. Yeats and the intricate sonnets of William Shakespeare, the goal was to reimagine what a modernized Shakespeare might write using contemporary English. This project was developed as part of the Computational Creativity course with the help of my project partner-H.P. Pranaav. By blending classical literature with cutting-edge AI techniques, the system aims to produce verses that capture both timeless poetic elegance and modern expressiveness.
Concept and Inspiration
The project began with an analysis of different poetic styles. Yeats’ accessible imagery and Shakespeare’s complex structures provided a rich foundation for experimentation. An early idea even emerged from a high school experience of studying Shakespeare’s As You Like It—envisioning the Bard learning modern English. This playful yet thoughtful concept drove the decision to blend Elizabethan aesthetics with today’s language.
Technical Approach
Initially, a Markov chain model was implemented as a baseline to generate text based on n-grams. While this method captured certain stylistic elements, its output lacked coherence beyond a few lines. To overcome these limitations, the project transitioned to a more robust approach using a Recurrent Neural Network (RNN) with Long Short-Term Memory (LSTM) cells. Key aspects of the technical implementation include:
Data Curation: The model’s training data grew from a modest 3,000 words to a rich corpus of nearly 30,000 words sourced from selected poems of Yeats and Shakespeare.
Model Architecture: A Bidirectional LSTM was used to capture context from both preceding and succeeding words, enhancing the quality of generated text.
Training and Optimization: Experimentation with training epochs and adjustments in data volume led to increasingly coherent outputs. Attempts to integrate a custom loss function aimed at promoting rhyming schemes further enriched the experiment, even though perfect rhyme was challenging to achieve.
Evaluation: The creative output was measured against criteria like originality, stylistic value, and domain knowledge, drawing on frameworks from computational creativity research.
Outcomes and Reflections
The final system successfully generates poetic verses that, while influenced by the source texts, exhibit a refreshing blend of old and new. Each run of the model offers unique combinations of familiar phrases and novel constructions, illustrating both the promise and the challenges of machine-generated art.
Access the complete project on GitHub, including the full paper, source code, and a collection of sonnets and poems created by our AI-powered poem generator.