Oulipo: Wordshift + 7

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram CDF Player or other Wolfram Language products.

Requires a Wolfram Notebook System

Edit on desktop, mobile and cloud with any Wolfram Language product.

The group of French writers, mathematicians, and artists called Oulipo (Ouvroir de littérature potentielle, roughly "Workshop of Potential Literature") explore many kinds of wordplay, puns, substitutions, and scrambled meanings, and their works can often be read in more than one way. Jean Lescure created S+7 (substantif+7, or noun+7), an algorithm for transforming text by replacing each noun in a specified text with the seventh noun that follows it in a given dictionary. The results are something like the popular Mad Libs books. In this version, you can control the source text (books from the curated Wolfram collection), the number of terms to offset (i.e., the number 7 in the original), and the parts of speech that are replaced (nouns, verbs, adjectives, prepositions).

Contributed by: William Sethares (September 2012)
Open content licensed under CC BY-NC-SA



A phrasal template is a structure that can be filled with specific words to form modified phrases with the same grammatical function, though the meaning may be quite different. The game Mad Libs is a common example, and this Demonstration implements a version proposed by the Oulipo group called S+7 as described in [1]. In this version, a source text is parsed and each noun is replaced by the seventh noun that follows it in the Mathematica dictionary. The source text can be chosen from the popup menu, the number "7" can be changed using the distance slider, and the parts of speech to be replaced are chosen using the checkboxes. One source of ambiguity is that words can often be used as different parts of speech, depending on the context. For example, "like" can be a noun, a verb, an adjective, a preposition, or a conjunction. Since it is difficult to automatically decide which sense of "like" is being used, this implementation simply considers each word to be only the most common type for that word, as given by how many variations of meaning are present in the Wolfram WordData[] dictionary. Thus "like" is always considered a verb, because there are five different verb meanings in the dictionary.


[1] M. Gardner, Penrose Tiles to Trapdoor Ciphers, San Francisco: W. H. Freeman, 1989.

Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.