More selected projects

If 2020 were a poem

"I have nothing to say / and I am saying it / and that is poetry / as I needed it"
— John Cage


produced by: Marina Cardoso

 

www.if-2020-were-a-poem.com

If 2020 were a poem is a physical-online installation that generates poems in real-time. Pieces of data are combined to create short, free-verse compositions about 2020. Each poem is a random three-part combination of a tweet that mentions the current year, a relevant headline from The Guardian since last January and words from the Wikipedia 2020's page.

A mini thermal printer is connected with a Raspberry Pi to print the poems using Javascript and Node.js. The algorithm makes requests to each API using specific parameters which are returned as text. In addition to the physical object, an interactive website allows the user to generate and view the content in a digital format.



Introduction

When the COVID-19 pandemic spread globally, many have relied on the internet to keep connected with friends and family in a period of social isolation. This naturally led to an explosive growth of social media usage over the past months, one using this medium to share thoughts, fears, frustrations—but also recipes and memes.

The name of the artwork comes from the If 2020 was/were meme, in which images from popular culture, objects or everyday scenes are used to make an analogy in regard to the year of 2020. This meme became popular on Twitter.

This work was an attempt to explore writing poetry with code, build an entertaining experience with data from different sources and to create a sense of comfort within the 2020 context.

 

Concept and background research

The use of computers to generate poetic text has been a subject of much research. The term "Generative poetry" is used to describe any program that uses an algorithm, conceived by the author, to generate poetic text. One of the first works considered computer-generated poetry is A House of Dust (1967), by Alison Knowles and James Tenney. Written in Fortran code, the poem uses line templates with slots to be randomly filled with words from a list.

Some writers have even observed the resemblance between coding and writing poetry, as Taeyoon Choi describes in his essay Poetic Computation: "There is something poetic about code itself, the way that syntax works, the way that repetitions work, and the way that instruction becomes execution through abstraction."

It is interesting to acknowledge here what is considered poetry. Unlike other kinds of text, form and content are key components of a poem. A poem usually has a structured pattern; the writing in lines, word repetition, rhyme and/or rhythm. This formula does not apply for all poems, for example, free-verse poems—which makes it more difficult to determine if a text is a poem. Then one can rely on the other element: content. Poems tend to use figurative language, emotions, feelings and abstraction. Of course, this is a topic open to many interpretations.

During my research, I came across works that related to my project. Times Haiku was created by one of the senior software architects at The New York Times, Jacob Harris. It consists of a blog of haikus (short Japanese poems) created using words from The New York Times home page. Another project is Google Poetics, a twitter account that posts poems made out of google search suggestions.

A researcher and artist worth mentioning is Allison Parrish. Besides teaching and giving talks about language and computation, Allison has a notable collection of work related to computer-generated poetry, including Autonomous Parapoetic Device (2008), A Travel Guide (2014) and Compasses (2019).

 

  • gallery-image
  • gallery-image
  • gallery-image
 
Technical

My interest in data and web applications at the end of the Masters was the starting point for the project. When looking at APIs I thought it would be interesting to use and mix content from different sources, then I came to the idea of creating computer-generated poems.

The Twitter API was the first component, and it is where the subject of the poems originated. After reading the API documentation, I started to search for tweets that mentioned 2020. Some parameters used to get the tweets were: containing "2020", in the English language, since March 2020, filtering out tweets with mentions, retweets, links and images. With a hand from regular expressions and the RiTa library for JavaScript, I could get rid of punctuation and emojis, for example.

As the 2020 motif is associated with events and the news, I decided to include content from The Guardian and Wikipedia on the poems. Both APIs were more straightforward to use than Twitter as they work with a JSON (JavaScript Object Notation) url. For The Guardian, I requested titles from relevant news in the "world" section since January 2020; on Wikipedia, I opted to get words from the 2020's page.

Content settled, it was time to work on the poem structure. To avoid word repetition, I decided to go with a short template of three lines, like in the Japanese Haikus. The metric would be free-verse, meaning there was no syllable counting nor rhyme. After many template versions, I was satisfied with the following structure:

Twitter text
The Guardian text
Wikipedia text.


The poem is an array of three strings and each string is a line. Instead of using the full sentence of each API text, I resolve to work only with the first three words from a random sentence. From Wikipedia, it would be two random words. In the end, I also decided to randomize the order of the lines.

A particular aspect of generative poetics is its unexpected results, the lack of control of the "author" (or programmer) over the output. In How to Write Poems With a Computer, John Morris observes that "One of the major happy effects of poetry generally, and of haikus in particular, is surprise."

Consequently, one of the biggest challenges when working with computer-generated poetry is related to semantics, even if the poem syntax is correct. The output can appear nonsensical, although from an artistic perspective this might be a positive feature. In this sense, I make the link of generative poetry with Dadaist poetry. Tristan Tzara, a founding member of the Dada movement, wrote instructions for making a Dada poem in 1920:

TO MAKE A DADAIST POEM
Take a newspaper.
Take some scissors.
Choose from this paper an article of the length you want to make your poem.
Cut out the article.
Next carefully cut out each of the words that makes up this article and put them all in a bag.
Shake gently.
Next take out each cutting one after the other.
Copy conscientiously in the order in which they left the bag.
The poem will resemble you.
And there you are—an infinitely original author of charming sensibility, even though unappreciated by the vulgar herd.

Additionally, my background in Graphic Design influenced me to include paper-based work. A thermal printer is a powerful alternative print tool, it is easy to use and it doesn't require any ink. I started testing to print the poems with the Star TSP700II printer I had at home. A way to print content from code using the Terminal command is by using CUPS, a printing system created for iOS and LINUX operating systems, or an npm (node package manager for JavaScript) written to work with thermal printers.

In terms of exhibition space, I thought it would be smarter to connect the printer with a Raspberry Pi instead of the laptop. My idea to display the artwork was to print poems in real-time where the visitors could read them. The driver for the Star TSP700II did not work well on the Raspberry Pi and the solution was to buy an Adafruit Mini Thermal Printer. Its design allows the printer to be easily attached to other objects, so I chose to fix the printer on a white plinth with a good height for readability. The yellow roll paper was picked to make the association with yellow pages from old poetry books. Finally, I used the watch command to run the print task continuously with an interval of 200 seconds.

The idea to create a website for the poems was tied up with the possibility of a remote and online exhibition, along with the will to keep the work alive after the show. The visual language was inspired by the thermal printer itself, yellow pieces of paper containing poetry. It was written with JavaScript and p5.js and hosted on Heroku—later linked with the bought custom domain address.

 

  • gallery-image
  • gallery-image
  • gallery-image
  • gallery-image
  • gallery-image
  • gallery-image
  • gallery-image
  • gallery-image
 
Future development

For future development, I'd like to make the Portuguese version of the poems. Another possibility is to save the best poems in a database and make a booklet or fanzine with them.

 

Self-evaluation

In general, I am quite satisfied with the outcome of the project and the positive feedback from the visitors. It was my first time working with generative poetry. However, I think I could have improved the algorithm with text analysis or machine learning to avoid ending the poems with pronouns and adjectives, for example. 

 

References (Theory)

Allison Parrish: Recent and Selected Work. [online]. Available at: http://portfolio.decontextualize.com/

Choi, T. (2017). Poetic Computation: Reader. [online]. Available at: http://poeticcomputation.info/chapters/ch.1/

Galván, CG. (2016). THE HOUSE OF DUST, BY ALISON KNOWLES. [online]. Available at: https://www.damnmagazine.net/2016/09/07/the-house-of-dust-by-alison-knowles/

Google Poetics. [online]. Available at: https://twitter.com/googlepoetics

Lamb, C; Brown, DG; Clarke, CLA. (2015). Can Human Assistance Improve a Computational Poet?. [online]. Available at: https://arena-attachments.s3.amazonaws.com/7842394/eb86c718231c943640eb1d22e090b411.pdf?1593615709

Lamb, C; Brown, DG; Clarke, CLA. (2017). A Taxonomy of Generative Poetry Techniques. [online]. Available at: http://archive.bridgesmathart.org/2016/bridges2016-195.pdf

Morris, J. (1967). How to Write Poems With a Computer. [online]. Available at: http://dwwp.decontextualize.com/pdfs/morris.pdf

Times Haiku: Serendipitous Poetry from The New York Times. [online]. Available at: https://haiku.nytimes.com/about

Toivanen, JM; Toivonen, H; Valitutti, A; Gross, O. (2012). Corpus-Based Generation of Content and Form in Poetry. [online]. Available at: http://computationalcreativity.net/iccc2012/wp-content/uploads/2012/05/175-Toivanen.pdf

 

References (Code)

API:Get the contents of a page | MediaWiki
https://www.mediawiki.org/wiki/API:Get_the_contents_of_a_page

Documentation | The Guardian Open Platform
https://open-platform.theguardian.com/documentation/

JSON - Working with Data and APIs in JavaScript | Coding Train
https://www.youtube.com/watch?v=uxf0--uiX0I

Linux Watch Command | Linuxize
https://linuxize.com/post/linux-watch-command/

Networked Thermal Printer using Raspberry Pi and CUPS | Adafruit
https://learn.adafruit.com/networked-thermal-printer-using-cups-and-raspberry-pi

Reference | RiTa
https://rednoise.org/rita/reference/index.php

Search Tweets | Twitter Developer
https://developer.twitter.com/en/docs/twitter-api/v1/tweets/search/guides/standard-operators

thermalprinter | npm.js
https://www.npmjs.com/package/thermalprinter

twit | npm.js
https://www.npmjs.com/package/twit

Twitter API Basics - Twitter Bot Tutorial | Coding Train
https://www.youtube.com/watch?v=7-nX3YOC4OA