The MechaPoet experiment

mechapoet-hammer-tongue

The MechaPoet has now retired from performance. She currently sits on a chair in my flat beside the printer. I like to think they are friends; possibly, in time, something more.

MechaPoet was an attempt to produce a performance poetry robot. The idea came from discussions about creating real-person slash fiction with text generators. This led to the idea of MechaPoet, an attempt to relieve human beings from the drudgery of writing poetry. Me and Chris (my partner in the enterprise) have posted a few times about this (1, 2, 3 posts from me and one from Chris ), but I thought I’d do a quick overall post summarising things.

The technical side of MechaPoet was relatively unsophisticated, being based upon Markov Chains. The wikipedia page on this is not a particularly easy read. A simple way to explain them is that the Markov chains store every combination of two words in a text, and the word that follows them. This map of the text can then be used to generate plausible sequences of words that aren’t found in the original text. The best explanation of Markov Chains is by on-the-lambda.com, who illustrate the concept with the Smiths song, this Charming Man. They go on to show how Markov chains can be used to generate wine reviews.

dp

Obviously the project wasn’t just using Markov chains. I found a corpus of word pronunciations and used this to find generated phrases that ended on the same sound, and this could be used to generate couplets. The rhyming made the poems much more interesting. To quote Chris:

As someone who gets a bit sketchy and stressed out when I hear a lazy rhyme (part of the reason that I gave up rhyming altogether a couple of years ago), it might sound like quite a contrary request, but I think it gives a real shape to what MechaPoet comes out with, and makes the leap from the sort of Avant-Garde poetry that looks like an arbitrary list to the sort of semi-avant-garde-rhyming-doggerel that can be all too familiar to someone who goes to enough poetry nights. What was surprising was what eventually came out – sometimes, poems that are genuinely quite moving, and which contain some remarkable and surprising images.

The idea such an unimpressive way of generating the content was not simply laziness. I’d been thinking of something Matt Jones had said, about being ‘as smart as a puppy’: “Making smart things that don’t try to be too smart and fail and, indeed, by design, make endearing failures in their attempts to learn and improve. Like puppies.” The idea bring that it’s best not to try being too clever, but to cover for the shortcomings by being charming – hence the cardboard body of the robot.

A good example of simplicity working well is a bot written by Mark Humphrys which ‘passed’ the Turing test with “profanity, relentless aggression, prurient queries about the user, and implying that they were a liar when they responsed”. There’s also the classic story about the Eliza bot, where people felt their interactions with it were both significant and personal.

We had an interesting ‘uncanny valley‘ problem with the voice. The first version of the MechaPoet used the FreeTTS voices, which were good enough to tell that you were hearing poetry, but many of the words were garbled. After a show-and-tell at Brighton Java, Luke Whiting suggested using Google text-to-speech.  This is incredibly good, so much so that I had to make it sound imperfect to make the listener more sympathetic. (There was some research on this effect, and I’ll add a link when I find it again). The final version of the MechaPoet was a server-based poetry generator which was accessed by an Android phone providing the speech generation.

I look very young in this photograph

During the project I met up with zenbullets and shardcore, two local digital artists. I first met them after telling them their dedbullets collaboration was featured in Kenneth Goldsmith’s Uncreative Writing. Zenbullets’ book Novelty Waves is worth a read, by the way, and some of shardcore’s talks are online – for example, What is it Like to Be a Bot?

Shardcore, quite rightly, pointed out many more sophisticated techniques I could use, but lack of time and focus meant I never explored them. It’s a great shame, as we were given some lovely ideas. As Shardcore writes about Markov Chains, “I’ve never been a huge fan of Markov chains for creating text, since the results can be somewhat haphazard and ungrammatical.”

There are still some fun projects involving the technique. King James Programming takes three texts as its source, moulding them into a new form. (“And it came to pass, that he who fleeth from the noise and confusion of ordinary software engineering or academic research.”) Or there is Garkov, which uses Markvo chains in an attempt to produce plausible Garfield strips.

I also wrote The MechaPoet in Java, which is a lousy language for hacking together prototypes, particularly for text manipulation – but when I wanted to produce the robot, I didn’t want to fiddle about learning Groovy, or sharpening my blunted Python skills.

MechaPoet was intended as a performance poet. She was involved in Chris’s award-winning Brighton Fringe show, as well as an appearance at the Hammer and Tongue night which, I think, baffled people more than it entertained. We never quite managed the trick of making MechaPoet entertaining rather than interesting.

(MechaPoet was a she, by the way. It’s amazing how many people assumed that a robot/performance poet must be a ‘he’. Hopefully, we weren’t sanctimonious in that, but if you’re going to gender a spray-painted cardboard box with a phone inside…)

I do want to return to the MechaPoet project at some point. I started work on a haiku generator (referring to haiku as the 5-7-5 version of the form). I’m convinced that the constrained, gnomic style of these haiku means it would be easy for a computer to create poetry far superior to what humans could do. My eventual plan is to use some sort of Bayesian filtering to pick good haiku. So far, I’ve got no further than a rather scrappy github repo. But it does at least have some unit tests.

I must also recommend Bot or not, which allows users to guess whether a piece of poetry is wtritten by a human or a computer. Apparently Blake’s The Fly is the most human-like poem written by a human being.

Where to publish your stories?

IMG_20140925_192149

On Thursday 25th I was involved in Flash-Fiction cinema with my friends Amy and Chris. The main feature of the night was a series of filmed short stories that had been sent in; and Chris and I each gave a talk about new types of fiction.

I spoke about Creepypasta, Slenderman, and the way truth and fiction merge. Writing the talk was interesting, provoking nightmares and night-terrors for several nights. Chris’s talk was about online hoaxes as storytelling, something he has quite a reputation for.

We learned about the Bicholim Conflict, an entire conflict that was faked on wikipedia, lasting five years before being discovered. Chris also revealed a hoax of his that I hadn’t heard about. Check out the wikitravel article for Shoreham-on-Sea, archived from November 2012. Notice anything strange? This lay unaltered for about 18 months. At one point, the Lovely Brothers excitedly showed Chris this strange thing they’d found.

At the end of his talk, Chris urged the audience, “Leave your stories lying around in unorthodox, unethical locations,” pointing out that his quick hoaxes had gained larger audiences than his self-published collections. Maybe people should embrace this new genre, flinging stories into the world to see which take root.

 

IMG_20140925_213408

IMG_20140925_195506

 

 

Rise of the MechaPoet

As the Fringe Festival recedes into memory, I realise I’ve not written a MechaPoet update. It was an interesting run. For a start, the show at which the MechaPoet appeared, Chris Parkinson’s Moonshine, won an award for being the Best Literature Fringe show ever. The only bad thing about the show was that Chris lost his European Flag on the final night.

IMG_20140528_232506

We had our first robot rebellion in the final show. Somehow the intro speech was triggered multiple times. It was a sold-out night and that seemed to go to MechaPoet’s head. She introduced herself, then she introduced herself, then she introduced herself again.

I also did some tinkering on the MechaPoet software ready for our first poetry slam. I tried using Bayesian Filtering on the MechaPoet to help it produce funnier lines. That was an interesting idea, but it didn’t really work. The data set was too small and widely scattered to produce decent results. What’s annoying is that I could have figured that out myself if I’d done a little pen-and-paper thinking-through before starting.

IMG_20140528_194741

MechaPoet signed up for a slot in the slam at Hammer & Tongue’s Fringe Special. She was one of five slammers and, it’s fair to say, the audience didn’t really get it. As I said earlier in this project, you don’t get a real idea about how well something works until you see it in front of an audience, and we need to overhaul the software before our next slam. But we did beat one of the human poets. And, whatever else I achieve in life, I had an audience of over 250 people watching a cardboard box on stage. (It’s true, MechaPoet’s literary career is more successful than mine ever was).

Since the Fringe I’ve been plotting the next stage of this project.  I’ve had some advice from Shardcore, who has been doing this sort of thing longer and more successfully than me (check out his Rap the BBC News project). Brighton rapper Jon Clark has also been playing with rapping computer programs and we had an interesting talk at my birthday party.

IMG_20140522_191503

There are several things we could do from here: printing generated poems for people, haiku, freestyle hip-hop. Or there is the original idea we had for the MechaPoet, writing an engine to produce computer generated Slash Fiction. And there’s also some talk of a robot poets vs MCs battle – I have some fantastic ideas about how to improvise obscenities that will make a (robot) rapper blush. We’ve also received an invitation for another outing which, paperwork permitting, will be in early September. I need to clear some time soon and start writing new code.

The MechaPoet’s first performance

The MechaPoet had its first performance at the Brighton Fringe last week as part of Chris Parkinson’s Moonshine show. The interesting thing about any performance is that you learn a lot when a piece encounters an audience. Responses can greatly – I’ve delivered the same story to both helpless laughter and stony silence – but seeing your work in front of a group of people adds new dimensions.

IMG_20140508_212918

I’m reasonably happy with how the performance went. We had no technical hitches with the MechaPoet, and the audience seemed interested by it. The main problem was that it slowed down the flow of Chris’s show. Chris’s work is funny and energetic, whereas the MechaPoet’s voice was a little too slow and there were just not enough funny lines.

Which means an interesting weekend of hacking around with the software, trying to make it funnier. The audience laughed most at lines about actual real things, references to Brighton and the like. So I’m going to try building a simple Bayesian Classifier to filter out bad lines and find funny ones. The perfect thing to do on a weekend that’s supposed to be a heatwave.

Bayesian classifiers are, basically, the tool used for a lot of spam detection. As usual, I’m using rather crude algorithms for the project. While this was part of the idea, when I spoke to a proper digital artist this week, he suggested moving away from the Markov Chains. Once I’ve got the current run of performances out of the way, I definitely want to do something more sophisticated – along with my plan for using the MechaPoet to destroy haiku.

It’s amazing how much work a silly project can generate.

 

IMG_20140508_212929

 

And Chris’s show? Of course I’m going to say it was excellent. It was particularly good to see a sustained performance from Chris (outside of a timed slam that is, ha-ha). It’s sometimes hard to take in exactly how much poetry Chris has done over the years I’ve known him. The middle section of the show is a sequence of his political poems, which make an interesting retelling of the last 7-or-8 years of Westminster life. There are short films too, including the stunning Pigeon in a Pizza Box. And Unreal City is still the greatest poem ever written about Brighton. The remaining shows are on the 22nd and 29th May.

 

 

The mechaPoet at work
The MechaPoet visits Chris’s work (photo by rmmbs)

The MechaPoet’s first outing

Exciting news! The MechaPoet’s first outing will be as part of Chris Parkinson’s solo show, Moonshine. The MechaPoet will have a short set, but I’d recommend going for the (human) poetry, short films and outright lies. Tickets are £5 each and the shows are on the 8th, 22nd and 29th of May. But don’t leave it till the last show to go see it as everyone else is planning to do that too.

poster_colour_72dpi

MechaPoetry

The MechaPoet is my attempt to rescue humanity from the drudgery of writing verse. I’m not quite sure when the idea emerged, but as Chris explains, we were originally considering a computer program to generate real-life slash fiction. Which might still happen, but these things take time (we originally hoped to debut the MechaPoet in February’s Brighton Science Festival Slam, which will give you an idea of our pace).

ChrisP, MechaPoet and me
ChrisP, MechaPoet and me

The MechaPoet finally made its public debut at this month’s Brighton Java meeting. It’s a mix of Chris’s hardware skills and my programming. MechaPoet takes a big pile of texts (tweets from me and Chris along with the texts of Jurassic Park and American Psycho), learns the patterns in them, improvises a rhyming poem, then recites it. The results are surprisingly good – occasionally a line will make me laugh or even prove moving. A lot depends on the soiurces used. Tweets tend to produce something quite emo, whereas novels produce something more consistent.

The techniques I’m using are not particularly obscure. Computer-generated poetry has a long history, dating back to the 1950s. Most of the techniques were outlined by the time Oulipo‘s ALAMO project wound down. The MechaPoet text itself is generated by Markov chains, not a particularly sophisticated technique (a really good, gentle introduction is here).

The Mechapoet is unveiled!
The Mechapoet is unveiled!

Chris has done a good job of explaining the non-technical aspects of the project, so I should probably talk a little about the programming. The MechaPoet was written in Java, which is a lousy language for hacking together prototypes, particularly for text manipulation – but when I wanted to produce the robot, I didn’t want to fiddle about learning Groovy, or sharpening my blunted Python skills.

The first version of the MechaPoet used the FreeTTS voices, which were good enough to tell that you were hearing poetry, but many of the words were garbled. There is a recording of the original voice on Youtube. I tried a number of different voice packages but couldn’t get any of them running on Ubuntu.

The good thing about sharing a project at an event like Brighton Java was getting feedback. Luke from Brandwatch showed me the latest Google TTS voices, which were incredible. I spent Good Friday hacking together a new version of the MechaPoet to run on my phone. The solution involved a microservice using Spring Boot with an Android client. It’s interesting to see the places a good project will take you, and making my first Android app was fun – although it would have been easier if I’d read more about programming Android in advance.

The only problem with the current version is that the new Google voice is a little too good. With a scratchy robot voice, people are more willing to forgive little errors in pronunciation and emphasis. The Google voice is so clear that there is something of an uncanny valley problem – errors are jarring rather than charming. The next piece of work I need to do is to reduce the quality of the voice a little to make it flow better.

The first stages of the MechaPoet
The first stages of the MechaPoet

There are some interesting questions about whether what the MechaPoet does is poetry or not. After all, many human poets such as Tristan Tzara and Kenneth Goldsmith have worked with algorithms or arbitrary techniques. William Burroughs argued that the cut-up technique was still authorship, since the user chose the source texts, where to cut etc. I’d argue that the MechaPoet’s work is actually written by Chris and I rather than the algorithm. Poetry is a wide and complicated artform: a good example of this is Bot or not, a website that asks you to choose whether a piece of poetry is human- or computer-generated. The crossover between those two categories is significant.

What’s next? Well there’s the possibility of an appearance at a gig, as well as some poetry performances. The main aim is to enter the robot into a slam to see how it performs against human poets. I also want to work on generated haikus: I genuinely believe is that a program can be written than will produce better haiku than any human does. Chris and I are also trying to find a bootleg copy of Alastair Campbell‘s diaries so we can generate new entries from that. (Imagine mixing his diaries with Jurassic Park? Wouldn’t that be incredible?)