In his 1940 essay “Theses on the Philosophy of History” Walter Benjamin tells story of a chess playing automaton. Dressed as a Turk, with a turban and the obligatory hookah in its mouth, the machine would impress with feats of competitive ingenuity. Unbeknownst to the crowd, a dwarf was hidden within its workings. An excellent chess player, he guided the automaton’s hand by means of stings. Originally meant as a critique on materialist theories of history, Benjamin’s allegory has been extended to critique automatism in general. In this enlarged formulation, the internet, for instance, is not a self-directed entity with a fixed set of properties but rather an aggregate of people and institutions using computer networks to advance a divergent set of very human agendas. Beyoncé might periodically win it, but the internet is no more a sufficient reason for human phenomena than any other factor, or so the argument goes. No matter how sophisticated the automaton, the human is always in some sense at the controls.
But how would the allegory change if the Mechanical Turk wrote instead of played chess? This is not idle speculation. Last year, the Associated Press used automated processes to write quarterly earnings reports for 3,000 companies, roughly ten times the number produced by human counterparts previously. Automated writing is not limited utilitarian forms like business news and product descriptions. The results, however, are decidedly more mixed. NaNoGenMo, the programmer’s version of National Novel Writing Month, was started 2013 by the Portland, OR based web artist Darius Kazemi. The object of the project is to complete a 50,000 page book by the end of November, only it must be written with software rather than the human hand. The computer generated novels are, as their programmers freely admit, mostly unreadable. Sustained narrative remains a problem.
Automated writing of the creative variety becomes much more convincing on a small scale. One standout example is Magical Realism Bot, an automated text generating program on Twitter, developed by the brother and sister team of Ali and Chris Rodley. Magic Realism Bot generates a different 140 character story every two hours, using random combinations of the various elements that define the genre: academic characters, mythical creatures, philosophical disputations, etc. The output can be amusingly absurd, such as “A fortune teller turns over a tarot card with a Gummi bear on it. Your destiny is to become a psychiatrist,’ he says to you.” But it can also resemble the work of real authors, at least in summary. “A learned society of mathematicians meet once a year inside a ruined synagogue to decide the fate of life on earth,” reads more like the scene from an Umberto Eco novel than the instantiation of a simple computer program.
Magic Realist Bot points toward a complimentary relationship that can exist between the modernist experiment in literature of the 20th century and the digital culture of the 21st. Both modes of thing involve subjecting language to intense analysis, natural language or machine language, taking apart its most basic components in the search for new modes of representing reality. Identifiable people still remain at the controls of these writing automatons, working as programmers rather than puppeteers, but the speed and sophistication by which these automatons fulfil their commands represents a difference in kind from past experiments in replicating human culture. Perhaps a new allegory is needed to replace the Mechanical Turk. Magic Realism Bot might very well generate one.
Ali and Chris talked to Asymptote about the technical basis for the Magic Realism Bot how that relates to how they engage with the practice of writing.
***
Matthew Spencer: Give us some background on yourselves. Specifically, I’m interested in how your efforts in social media, computer science and literature came to intersect.
Chris Rodley: I’ve wanted to be a writer since my early teens, and my literary heroes were the great experimental modernists like Woolf, Joyce, Brecht. Of course many contemporary writers of fiction and playwriting have turned away from this kind of bold, free-wheeling experimentation, maybe in part because where do you go after Finnegans Wake? This would sometimes frustrate me!
Recently I’ve come to see that the intersection of literature and technology, including social media, is a really exciting locus of experimentation in writing. But although it’s been around for decades, electronic literature still isn’t a field that huge numbers of conventional writers consider working in, though that’s slowly changing. One reason, perhaps, is that creativity at the intersection of literature and computing requires breaking the mould of what authorship looks like: either in that it can mean learning to code or in my case collaborating with someone who can (though there’s a great third option too, which is using platforms like Twine). Collaborating maybe seems weird for writers steeped in the romantic ideal of the solo creator. But, I think, increasingly, interesting literature will be the product of collaborative efforts. Not just collaboration in the sense of working with programmers or graphic artists, etc, but also in the sense of working in and with social media (for example, remix, recontextualisation and digital “conceptualism”).
Going back to my own development, since 2013 I’ve co-created a series of electronic literature works with media artist Andrew Burrell. One of these was “Everything Is Going To Be OK”, which constructed a short play script in real time out of remixed tweets from Twitter. A more recent project with Andrew was “Death of an Alchemist”, which was our attempt at creating a novel generated in real-time from online data (tweets, gifs from Tumblr, weather reports, etc). So as a result of that work I was already in the territory of looking at how lit and social media can be brought together.
The other influence for me is that I’m also a PhD candidate at the University of Sydney where I’m studying the impacts of social media on digital writing. Partly this is about avant-garde literature but it’s also about how the availability of social data is changing journalism and vernacular writing practices.
So I guess Magic Realism Bot was a product of those various influences!
Ali Rodley: I have a background in special education, and I’m now a computing studies teacher here in Sydney. At the moment I’m completing a computing studies degree. The bot was a great opportunity to get to know the programming language Python a bit better and apply it to a new challenge.
MS: Briefly describe how you built the bot. Please do include details about the relevant code if it takes a different approach than what is usual with these types of programs.
AR: I wrote the code from scratch in Python with a MySQL database, specifically for MagicRealismBot. Basically, there are a number of tweet templates we call bases. Each base has some hard coded text interspersed with placeholders for various parts of speech.
The placeholders can also carry tags which are used to filter the possible words that could be used in any position. For example, a placeholder for an object could be $ob-thing-concept-structure. The script collects all the objects with those tags then chooses one at random.
Part way into the process we introduced a new kind of ‘special’ placeholder to add variety to some of the bases. These generally contain short phrases rather than single words and always contain additional placeholders of their own. Objects, verbs, adjectives and people can also contain placeholders. This nesting often turns out to be quite deep, increasing the variety of results.
I included a few additional routines to polish the output a bit. There’s a mechanism for altering the verb when something like ‘prime numbers’ or ‘opposites’ turns up in a spot that would normally be singular. All person nouns are marked she/he/either to avoid using ‘they’ all the time. When a pronoun placeholder is encountered, a function searches for the person in the story and uses the appropriate pronoun or a random one. Functions from the Python library inflect.py take care of a/an and pluralisation. These kinds of details help the bot not sound so “bot-like”.
CR: Two of the key writing tasks were to create the bases or templates, and to collect a large vocabulary to populate them with. You could compare this to coming up with the two types of cards in “Cards Against Humanity”: the black “fill in the blank” cards and the white cards which supply nouns, including gerunds. Well, that was the job early in the bot’s development, anyway: we had a more or less rigid sentence structure populated with some nouns and an adjective or two (eg “an Assyrian queen writes love letters to darkness”, “a lonely prince discovers a tree made of prime numbers”). As it has gone on, we’ve progressively made these syntaxes much more complex and stochastic, because after a while those recurring templates get boring. So now there are all kinds of special variations, second sentences, even lists. Also, the verbs often now vary, which completely changes the premise of the tweet: instead of “writes love letters to”, it might be “tries to destroy”.
Deciding on a suitable vocabulary was also obviously important. Initially I put in lots of quintessentially “magic”, other-worldly words: swans, moons, labyrinths. As it’s developed, I’ve added a bunch of ordinary, everyday words as part of an ongoing process of trying to ensure it has lots of day-to-day variation and unpredictability.
MS: What are your thoughts on the relationship between coding and natural language? What are the important similarities and the important differences? Specifically, do you see coding as being able express the full range of literary expression (for lack of a better term)? Or will some essential element within natural language make that goal impossible?
CR: Actually I think there are closer ties between bots and conventional writing than there might appear. There is, for example, a website you can visit called Bot or Not which invites you to guess whether the poetry is generative or written by a human. And it makes it hard to tell which is which, and many people misidentify robot poems as being authored by humans. However, I think it’s important to recognise how conventional literary output has long depended, and will increasingly be dependent, on technology and networks, including social networks to some extent. In the past, this might have been the technology of the typewriter, the book (dictionaries, encyclopedias), the library catalogue, the postal system. Currently, it’s things like Google Search, autocorrect, spell checkers, online thesauruses, social networks like Twitter or Facebook where writers source inspiration and discuss their ideas. Moreover, bots and other generative writing usually (except perhaps in the case of machine learning) rely on human creativity in the code itself, in the syntax, in the vocabulary, and in the case of Markov bots, the original creation of text that is algorithmically remixed.
If I had to put money one it, I would wager that relatively automated processes will at some point lead to really compelling forms of literary expression across many different genres. Currently, it’s good for quite specific forms of expression I think (like putting together hitherto unconnected concepts as in Magic Realism Bot). Twitter as a platform is great for bot writing, of course, because the retweet function helps “successful hits” get more widely seen.
MS: Why magical realism? Did you think about using other genres?
CR: Nope, not really. I’ve always loved stories that rely on big ideas, high concepts and strong “hooks”. Kafka, Borges, The Twilight Zone, plays like Friedrich Dürrenmatt’s The Visit, the classic Stephen King short stories and novellas and classic detective fiction too (think Agatha Christie’s Murder of Roger Ackroyd). In other words, a story that is engaging as a narrative but also original and interesting as an idea, conceptually or even philosophically. So partly Magic Realism Bot comes from having an interest in these, coming up with these types of premises in the conventional way, and wanting to find a way to generate them programmatically.
Jorges Luis Borges is famous for this kind of literature of ideas, and I’m a huge fan. I realised a while ago that many Borges stories tend to follow a specific pattern: the telos underlying a particular idea or structure is exaggerated ad absurdum, so that it overfulfils it. (A library, a maze, a map…) This led to the idea to create a “BorgesBot” which would generate Borgesian story ideas. After a while, it became clear that the particular affordances of the Twitter bot are best suited for magic realist story ideas much more broadly defined (a book inside someone’s heart, a rainstorm of cathedrals). In other words, keeping it to Borgesian ideas (which are quite dry, rather than colourful and visual, and also metafictive) was too limiting. Currently the bot draws inspiration from a bunch of magic realist authors as well as other genres (fantasy, children’s lit, YA, detective fiction).
Another reason why the bot is a good fit for generating magic realist premises is that it can create links between ideas and concepts that aren’t normally connected, that are totally divergent, in a way that humans don’t easily do. We can imagine of someone drowning in a lake filled with water, or maybe lava, but it’s less likely we’d easily think of a lake filled with clocks, tigers or prime numbers.
A third reason for choosing magic realism is that Twitter maybe isn’t particularly amenable to long-form narrative, but it can do microstories and particularly premises or loglines well. (See also Nora Reed’s @thinkpiecebot). So I think this is a format that works well for it.
MS: What are some of your favorite entries written by the bot?
AR: A depressed archduke builds a swimming pool that is filled with optimism came up during testing back when it was still BorgesBot and is still one of my favourites.
CR: A few weeks ago we added some templates that include direct speech and I think they’re working pretty well:
A pine tree whispers to a princess: “I wish I was a rose bush”, and
A beehive whispers to an opera singer: “I wish I was an opera house.”
A few others I have liked are:
A 14th century queen passes a law against opposites.
A famous librarian discovers a painting that depicts every single owl in the world.
A hen lays an egg. A fox is inside it.
A schoolteacher invents a new kind of astrology based on the movements of swans.
I also like the particular template that devises magic realist detective novels, like “A murder mystery in which the killer is revealed to be Velazquez’s Las Meninas.”
*****
Read more Interviews: