Markomposition is a Markov chain poetry generator. It first builds a Markov chain from a given piece of text, then creates a new piece of text by randomly combining related transitions from the Markov chain.
Greater fusion between different parts of the original text is produced by decreasing the order of the Markov chain used to model the text.
Here's a quick introduction to Markov chains and how they are used in this project!
The quality of the output depends on the quantity and quality of the input.
Poems will feature greater variety if the content has high frequency of repeated phrases. If every word has only one successor, there's only one possible way to build a new poem -- and it's the exact order of the original content, if spaced slightly differently.
Often, the best poems will be produced from a lot of text -- as in, whole book size. The abundance of content provides lots of variety and creates a large model from which the generator can choose random combinations.
I provide sample text from Project Gutenberg as a starting point. I would encourage you to browse their online library of free ebooks for other content. You might also consider using screenplays of movies or television shows, newspaper articles or columns, recipes, court transcripts, legal documents, historic records, instruction manuals, textbooks, or any combination of the above -- inspiration for poetry is everywhere!
Markomposition was originally adapted from coursework I completed during the Fall 2012 offering of COMP 140 at Rice University. The coursework was in Python, but Markomposition is written in Javascript and many more features than the original script -- and hopefully more on the way!
The generation of poems with specific rhyme or meter is made possible through the use of the Irvine Phonotactic Online Dictionary. Shout out to my good friend K.F. for the computational linguistics expertise she shared with me as I developed this project!
I provide sample text from Project Gutenberg for Markomposition. The selections do not appear in their original format, but have been edited to remove prefaces and other text that is not directly the work itself. The Gutenberg ebooks used for this project are:
Body text is set in News Cycle font with selected headings set in Pompiere font.
My latest project is a math and logic game called one.two.tree. I created it as a fun way to improve my arithmetic skills.
For more of my past projects or work experience, here's my portfolio. Want to know what I'm doing next? Follow me on GitHub!