An AI haiku generator that creates three-part narrative sequences telling cohesive stories
for
Computational Creativity
❦
For the first Computational Creativity assignment, we developed a computational poetry system that generates cohesive three-part haiku stories using Markov chains and custom grammar formatting. I was responsible for curating the inspiring text datasets, doing research on the types of Japanese poetry, and keeping track of our progress through the logbook, while working collaboratively with my teammates on the Python implementation in Google Colab. The challenge was to create a system that could generate not just individual haikus, but three connected haikus that told a complete story with proper 5-7-5 syllable structure and seasonal references.
I curated five distinct text datasets to guide different aspects of the story generation: separate files for "beginning," "middle," and "end" narrative elements, plus "vibes" and "season" files to ensure thematic cohesion across all three haikus. The most challenging aspect was ensuring each dataset contained enough varied content to prevent repetitive outputs while maintaining the specific emotional tone and seasonal imagery required for authentic haiku composition. We used Markov chains to add an abstraction layer between the input texts and final output, creating unexpected word combinations while maintaining grammatical structure through a custom formatting system.
The technical implementation involved creating custom Python classes including HaikuWord (tracking syllable count and parts of speech), WordList (organizing words by grammatical function), and HaikuFormatter (ensuring proper haiku structure). We used NLTK for parts-of-speech tagging and syllable counting, though this required some manual adjustments since NLTK incorrectly counted syllables for words ending in 'e'. The system generated multiple haiku options, and we selected the most compelling three-part stories for final presentation.
For the presentation component, we used various Text2Image APIs to create visual representations for our generated poems. We successfully generated atmospheric images that complemented our haiku stories and created a cohesive presentation that enhanced the perceived value of our computational poetry. This project taught me how layered creativity in AI systems works, from curating inspiring datasets to implementing algorithmic transformation to final artistic presentation, and how each layer contributes to the overall creative output while maintaining elements of surprise and authenticity.
☙
The three haiku stories created for Computational Creativity