Category Archives: Electronic Literature

Zeitgeisty Aphorisms

In Summer 2023 I attended the Electronic Literature Organization’s conference in Coimbra, Portugal to present a bot that generates aphorisms on social media. The bot is also featured in the virtual gallery for IMPEC 2024. The code repo is here, and you can read all the generated aphorisms here. I initially used Twitter X but because that platform is a dumpster fire I now use Mastodon.

This project is an experiment in using computation to produce an electronic literature that is attentive to social concerns and promotes constructive contact between different publics that coexist but do not always interact within a shared social media platform. So far the bot has 12 followers. It’s a start!

Mallarmé in 3D

Last month Taper #6 was published, featuring two code poems I wrote on the theme of “a throw of the dice,” in reference to Mallarmé’s poem Un coup de dés. In a version that includes results from my experiments with anaglyphic text, I modified Des coups d’Un coup de dés so that sequences of nouns from Mallarmé’s poem appear in three dimensions (you will need special glasses for the effect).

Anaglyphic Text

In the Oulipo’s La littérature potentielle (Gallimard, 1973), François Le Lionnais brainstorms several ideas for new literary forms that would depend on computer technology. One of these forms is what he calls anaglyphic text:

Literary texts are always planar (and even linear, generally speaking): that is, they can be represented on a sheet of paper. A text could be composed whose lines were situated in a three-dimensional space. Reading it would require special glasses (one red lens and one green) using the anaglyphic method that has already been used to represent geometric figures and figurative scenes in space.

One will notice an attempt at orthogonalization within the plane, in the acrostics. (34)

By “acrostics” I think Le Lionnais means that one can read not only within a traditional two-dimensional plane but also depth-wise, focusing on elements in the same syntactic position on different planes and observing spatially how the elements differ semantically.

I have programmed two examples of anaglyphic text based on early examples of Oulipian writing (you will need the special glasses for the full effect). The first is an interactive version of Raymond Queneau’s Cent mille milliards de poèmes. In this version, the reader selects one of the ten options for each verse in a sonnet and the selected verses advance toward the reader while the other verses recede. The reader can see all the verses at once, generating a particular instance of a sonnet while keeping all options for each verse within sight.

Because of copyright considerations, I must refrain from sharing the full anaglyphic version of the Cent mille milliards de poèmes. Below is a screen shot to give you an idea of how it works.

The second is a version of N + 7, whereby one takes a text and replaces every noun with the seventh noun that follows it in a given dictionary. The procedure can be generalized to W ± n, where W is any part of speech (noun, verb, adjective, adverb, …) and n is any integer. The Oulipo’s first examples of N + 7 were produced “by hand” with printed dictionaries, but the procedure clearly lends itself to computation where the writer can easily look up words and experiment with different source texts, dictionaries, and values for n. The first instance of a program for N + 7 was written by Dimitry Starynkevitch on a mainframe computer in 1963, when computers were relatively rare and expensive to use (Bens, 199). The web application below combines W ± n with anaglyphs as a viewing option. The dictionaries are sorted word lists extracted from the Brown and Gutenberg corpora (containing respectively 38,879 and 33,924 distinct lemmas) included with the Natural Language Toolkit, and the tools for parsing source text, conjugating lemmatized verbs, and performing other linguistic tasks come from the pattern Python module.

If you see notice of a server error, try running the program in a separate window (current browsers do not like third-party cookies when displaying embedded content with an iframe).

The anaglyphic version of N + 7 allows one to experiment with different source texts, dictionaries, and values of n and see ten variations of a source text simultaneously (with some scrolling), reading both planarly and in depth.

The source files for both these web applications are available here.

Works Cited

Bens, Jacques. Genèse de l’Oulipo 1960-1963, La Castor Astral, 2005.

Le Lionnais, François. “Idea Box,” trans. Daniel Levin Becker. All That Is Evident Is Suspect: Readings from the Oulipo 1963-2018, ed. Ian Monk and Daniel Levin Becker, McSweeney’s, 2018, pp. 34-39.

Queneau, Raymond. Cent mille milliards de poèmes. Gallimard, 1961.

Computation and Rhetorical Invention: Finding Things to Say With word2vec

Is it possible to make a sonnet based on a theme without having to attend simultaneously to form? Can one focus on inventio to generate a poem and leave much of the elocutio to algorithms?

Below is a web prototype for generating sonnets in French, English or Spanish using verses from the Théâtre Classique‘s collection of plays, Allison Parish’s compilation of poetry from Project Gutenberg, or the Corpus of Spanish Golden-Age Sonnets. The code, available here, makes use of natural language processing tools to enable a user to invent (in the rhetorical sense of finding things to say with language) a sonnet with an initial verse and a pair of words as the basis of an analogy using word2vec. For now the initial verse is selected with a quick word search against the corpus, and only the first 50 random verses that match the query are retrieved (if there are 50 or less verses that match the query, all of them are retrieved). The pair of words can be anything in the corpus, and while terms such as femme and homme establish a clear binary opposition with the same part of speech, any two words can be used. The pair serves as the basis of an analogy (one of Aristotle’s topoi for rhetorical invention) for systematically transforming a verse, word by word. The procedure (explained more fully in the code repo) takes a verse, modifies it by analogy, finds another verse in the corpus that most closely matches the transformed verse and adheres to a specific rhyme scheme for sonnets (abba abba ccd eed, with alternating masculine and feminine rhymes in French), and repeats the process until 14 verses are selected.

Go ahead and generate a sonnet, using the defaults if you wish, and see what happens:

You may invent imperfect sonnets with the generator. All the verses in French should be alexandrines, and those in English pentameters, but sometimes the rhymes are off, either because the same rhyming word is used repeatedly or two words that are supposed to rhyme do not. This is a bug I am working on.

You will notice that if you move the pointer over a verse, green italicized text will appear. This text is the result of transforming the verse by the analogy based on the pair of words. In this way you can begin to infer how each verse was selected from the corpus to generate the sonnet. If you supply other words as parameters, you can find verses with different analogies.

Another recently added feature is the ability to edit the last verse selected. The code attempts to verify that the edited verse complies with the defined rules for rhyme and scansion for this particular kind of sonnet, and if the edited verse does not comply, it is rejected and the original verse is restored.

The idea for selecting verses from other poems in order to assemble a new poem is not new. As early as the third or fourth century C.E. authors were recycling verses from Virgil in a form identified by Ausonius as the cento.

This is very much alpha code. It may be possible to produce an interesting sonnet, but what I find interesting in this project is the way one can model a particular approach to inventing poetry to observe how tools usually deployed for computational analysis (word embeddings, tf-idf vectors, phonetic transliteration) can contribute to creative synthesis.