Walt Whitman's use of free verse became apprec...

Walt Whitman's use of free verse became appreciated by composers seeking a more fluid approach to setting text. (Photo credit: Wikipedia)

When you write, there’s usually something you want to say. Answer the good old 5W+H at least.

Poetry is pretty exploratory though. When you start, you have barely a vague sense on what you’re trying to achieve. You’re conveying emotion rather than meaning. Form matters a lot as well.

A lot of creative writing looks like that.

For humans, this is very fun, for computers it’s a huge problem though. Just the definition of an algorithm says it needs to reach The Goal in a finite amount of steps. Whoops, now what?

The many attempts at making a computer write poetry can be put in four categories: word salad, template and grammar-based, form-aware generators, poetry generation systems.

1. Word Salad generators

judy gotta want upon someone.
wanna sadly will go about.

sammy gotta want the thief him but the
every reason. real distance carry.

Most early attempts just strung together random words. Perhaps using a markov chain of some sort, but mostly the result doesn’t make sense and looks like an alien tried to write a poem in a random human language.

This is not poetry.

2. Template and grammar -based generators

All green in the leaves
I smell dark pools in the trees
Crash the moon has fled

A slightly better approach uses templates, that are then filled with random words. For example the above poem comes from Masterman’s computerized haikus, where the computer filled in a template:

All [1] in the [2]
I [3] [4] [5] in the [6]
[7] the [8] has [9]

A similar approach is to use a grammar:

IN THE MORNING + noun phrase with a noun as head + WILL + APPEAR / BE
/ BECOME / SEEM / TURN + adjective phrase
Ishar Singh 'Ishar' Bhaiya reciting a poem

Ishar Singh 'Ishar' Bhaiya reciting a poem (Photo credit: Wikipedia)

These generators do create text that looks like decent poetry, but with a suspicious amount of human intervention. Would you call a poet just filling in blanks, well, a poet? Probably not. But the texts do fulfill the grammaticality requirement, so it would seem we’re on to something.

Fun fact: the only two computer systems to have published poetry (RACTER and PROSE) were of this type.

3. Form-aware generators

Scattered sandals
a call back to myself,
so hollow I would echo.

Crazy moon child
Hide from your coffin
To spite your doom.

You broke my soul
the juice of eternity,
the spirit of my lips.

This type of system is designed specifically with grammaticality and poeticness in mind. Two thirds of the way to proper poetry!

In An Evolutionary Approach to Poetry Generation Manurung lists four prominent examples of this kind of system:

  1. Gervas’ WASP system, which creates different types of classical Spanish poetry. Mainly aiming to fulfill the parameters of metre and rhyme. It uses verse patterns that are similar to previously mentioned templates, but are different in that they are more sophisticated since the algorithm gets to pick every word instead of just a few
  2. Ray Kurzweil’s Cybernetic Poet, or RKCP, this one is proprietary and so not much is known about how it works, (it produced the above poem, btw). The interesting aspect of RKCP is that it uses an existing poet’s corpus as a basis for its own creations, which is something I’m striving for in my own thesis.

    Ray Kurzweil at UP Experience 2008.

    Ray Kurzweil at UP Experience 2008. (Photo credit: Wikipedia)

  3. There is also ALAMO group’s Rimbaudelaires, which is apparently a template-filling system that creates its own templates by cutting out nouns/phrases/etc. from sentences and then filling them back in with random words, that follow strict rules for poeticness.
  4. Perhaps the coolest is POEVOLVE. It uses the reflection-engagement cycle to create an evolutionary approach where many different versions of the same poem are kept in a sort of tree and then pruned based on how promising they seem. Eventually the system would create proper poetry, however the only part implement so far is a poeticness generation system, so we cannot know for certain the proposed full implementation would even work. But it does look very familiar to how Manurung approaches the problem in the thesis.
This is still not poetry.

4. Poetry generation systems

no solo en plata o viola truncada
se vuelva mas tu y ello juntamente
en tierra en humo en polvo en sombra en nada

Finally we reach a class of systems that actively try to create text that is meaningful, poetic and grammatical. Poetry, according to our definition.

Good examples of these sort of systems are ASPERA and COLIBRI, which use case-based reasoning to produce good looking Spanish poetry.

A case-based reasoner attempts to solve a new problem by consulting an explicit database of existing problems and their solutions (Luger and Stubblefield, 1998). This process is described by Aamodt and Plaza (1994) as a cycle of four processes, namely retrieve, reuse, re- vise, and retain.

Essentially the system takes some poem fragments as input, looks them up in a database to get some word patterns to create a sort of template. This is then filled in with random-ish words that fit some particular metre patterns etc.

Through a few revision steps the software eventually produces a verse and stores it back in the database, to be used later on.


The Poet Tree in Cabbagetown Toronto

The Poet Tree in Cabbagetown Toronto (Photo credit: Wikipedia)

So there you go, the whole field of automatic poetry generation laid out before your eyes. The minimal overlap between different systems clearly shows that this field is virtually nonexistent since not much consensus has been reached on how this should be done … since the early 1970’s.

Then again, the paper I’m reading is by now almost ten years old, so maybe there’s a bunch more science out there than I can even begin to comprehend. Just two months ago I had no idea anyone had ever thought about doing automagic poetry “properly”.

Enhanced by Zemanta

Learned something new? Want to improve your skills?

Join over 10,000 engineers just like you already improving their skills!

Here's how it works 👇

Leave your email and I'll send you an Interactive Modern JavaScript Cheatsheet 📖right away. After that you'll get thoughtfully written emails every week about React, JavaScript, and your career. Lessons learned over my 20 years in the industry working with companies ranging from tiny startups to Fortune5 behemoths.

PS: You should also follow me on twitter 👉 here.
It's where I go to shoot the shit about programming.