Poem Generator
I have one project that's more successful than all my books put together, and I arrived at it entirely by accident. It's called Song Lyrics Generator and it's basically just a bit of fun that I knocked up when I was at university, to amuse my friends, which then exploded.
Over the last few months, I've been collecting suggestions from people that use the site, and the one request that came up over and over again was for a poem generator.
I shied away from writing a poem generator for years, because it seemed too difficult. Song Lyrics Generator takes existing songs and mixes them with users' input, to make new songs. The lyrics style is flexible; it's easy to stretch or bend a sentence. Song lyrics are often fairly nonsensical, so people looking for song lyrics are rather forgiving of the odd quirk. Poems, on the other hand, are usually structured. Yes, I could write a freestyle poem generator, but what else would I put on a poem generator site? One poem type isn't enough to keep people coming back.
There are a fair few site out there that automatically generate poetry. Whilst many of these are very good, I feel that some of them cheat. For example, I found a rhyming poetry generator that works by only putting user input in the middle of sentences, thus the final rhyming words are always the same. I found an acrostic generator that uses a bank of sentences that it picks from at random, with no opportunity to pick a subject or guide the poem's meaning.
Having outgrown writing simple generators like my song and plot tools, I knew if I was going to create a poem generator, it would want it to be something that creatives rather than simply shuffles.
After a little research, I was lucky enough to find Datamuse and The OED's API, which has allowed me to programmatically find rhymes, analyse words, count syllables and other useful literary tasks.
This opened up the opportunity to program a robot that could write rhyming poems such as limericks, or poems with a clearly define syllabic structure such as sonnets and haiku.
Visitors to the site describe the topic of their poem. My code then searches for words that could be useful, such as rhymes and adjectives commonly used to describe the visitor's topic. It tries to fit them to the structure and if that doesn't work, it finds synonyms and keeps searching for lines that work.
Because a computer write the poems, the results are sometimes slightly random. Much modern poetry requires the reader to infer meaning - I remember poets at writing groups saying, 'I'm not going to tell you what it's about. I want to know what it means to you.' Therefore the poetry format is perfectly suited to computer generated content because the reader's mind adds meaning to the odd obscure concept.
Computer generated poetry occasionally breaks grammatical rules, for example if a word has two meanings and the robot guesses the wrong one. However, people who want to perfect their automatically generator poems can easily copy them into their clipboards and tweak.
Another way I've allowed for unexpected results is the inclusion of a 'Refresh' button. If the user is not entirely happy with the first poem generated, they can reload the page until they find one that they really like.
Here are some examples of automatically generated poetry:
Tomato Plant - A Haiku
Showery summer
A wet tomato plant thrives
by the lack of sun
A Lass Called Rosen
There once was a young lass who wrote.
She thought she was rather remote.
Her name was Rosen.
She got quite frozen.
She couldn't resist the anecdote.
Summer - An Acrostic
Showery flurries brighten.
Ultraviolet rays accentuate.
Muggy nights bask, sometimes.
Marshy soils sunbathe.
Excellent storms invade.
Rainy holidays shimmer.
Please visit www.poem-generator.org.uk and let me know if you come up with any beauties.
+