University of Pittsburgh
This activity asks students to analyze and create *genre generators*, which are text generators that use the computer to create new instances of a formal written genre. After the instructor introduces the concept through a collaborative analysis of implementations of Christopher Strachey's *Love Letter Generator*, students then work in groups to produce non-executable conceptual programs that would produce new instances of genres they have chosen. The instructor then enacts a selection of the programs in code and leads another collaborative analysis exercise in order to highlight the rhetorical and social dimensions of the decisions that students made in the process of automation via a digital computer. By emphasizing the programming process and not asking students to code, students can develop a better understanding of how computer programs mediate digital technology and human understanding of the world.
Original Assignment Context: Intermediate-level digital humanities course
Materials Needed: a higher level programming language that allows for the manipulation of text strings with lists and variables (e.g. Python, which is used in `generator-template.ipynb`), the ability to present code and text in sequence (e.g. Jupyter Notebooks, which can present Python and Markdown in sequence, as shown in `generator-template.ipynb`)
Time Frame: ~2 sessions
*Genre generators* are text generators that use computer code to produce and manipulate text and create new instances of a formal written genre.1 This in-class activity, which walks students through the process of creating their own genre generators, is intended not to teach computer code—which requires knowledge of how to use specific programming languages—but rather *programming* as a conceptual process enacted by people to mediate between the world, their understanding, and digital technology. Where *coding* requires adherence to the rules of one or more programming languages, *programming* is the conceptual process whereby the problem is reworked and solved more generally. Think of it this way: to program is to know you might need a list of words that is pulled from at random in the generation of a new sentence, while to code is to know how to define and choose objects from a list using a specific programming language.
This activity was created for a course called "Digital Humanity," which is an undergraduate course that covers several topics around being human and the meaning of *humanity* in a time of digital ubiquity. It focuses on technological and social elements of computers in tandem to frame the various topics in the course. As described in the next section, this context directly led to the creation and shape of this activity.
While certain parts of digital technology, programming, and code will need to be established by the instructor in class before the activity, students themselves will not need to produce any code that can be run on a computer, as the emphasis is on programming. This distinction can help students understand that the computer is at once technical—that is, a material object with certain ways of functioning that create both limitations and affordances, as is the case with technology generally—and social—that is, made use of by human beings for human-defined goals based on their understanding of the world around them.
The activity, which runs for at least part of two sequential in-class meetings, leverages students' experience with and understanding of *formal written genres* to collectively analyze implementations of a specific computer program, Christopher Strachey's *Love Letter Generator*.2 Designed in the early 1950s, Strachey's generator stands out in the history of computers for its use of computational resources and programming for the purpose of text generation. Strachey worked from a handbook compiled by Alan Turing for the Manchester Mark 1, one of the earliest stored-program computers, and created a lengthy program that put the computer's resources toward something distinctly human—the writing of love letters.3
Once the relevant aspects of formal written genres are recalled and applied,4 students make use of this knowledge to understand how the implementations of the Love Letter Generator enact our understanding of the love letter as a genre through looking at the code underlying them, with an emphasis on broad concepts used in programming such as string generation and manipulation as well as the use of lists and variables. Then, in small groups, they define a different written genre (e.g. an email to their professor, an obituary, or a job ad), identify its purpose and key features, and consider which elements of the genre can be represented with digital technology via programming. Finally, the instructor enacts a selection of the student programs in code, turning the analysis toward the students' genre generators to draw out the way the students' practices were, like programming more broadly, a back and forth between the computer's technological basis and the non-technological understanding of genres that they represented with that technology.
The original context for this activity was "Digital Humanity," a course that intertwines the technological and social elements of the computer to frame conversations about being human and the meaning of *humanity* in a time of digital ubiquity. It serves as a philosophy general education requirement at the University of Pittsburgh for majors in fields across the humanities, social sciences, and natural sciences, but also acts as a major requirement for students in Digital Narrative and Interactive Design, an undergraduate major which incorporates courses from the English department and the School of Computing and Information. While its audience includes and benefits students who code, there is no presumption of technological facility beyond that required by the university more broadly: the ability to use a web browser, email, learning management systems like Canvas, word processing technology, and video conferencing software like Zoom.
The course's focus on the technological and social elements of computers in tandem guided the design of the syllabus the first time I co-taught it with one of the original developers of the course,5 as well as the second time when I taught it alone. I wrote this activity for this second iteration after reviewing a shared teaching document: one week, Prof. Langmead used the Love Letter Generator as the basis of a conversation, and the program seemed perfect for helping students grasp how *programming* involves a person who makes interpretive decisions about how to represent the world.
Despite the idiosyncratic context from which this activity arose, I think there are three broad criteria that can help someone identify if this activity is appropriate for their course.
If these three criteria are met, I believe that the activity could be implemented into a course regardless of its home department. While the rhetorical analysis part of the assignment might seem limiting in terms of instructor comfort with guiding the discussion, I think that the questions provided in `instructional-guide.md` and the instructor's own awareness of the contexts, purposes, and norms of written genres in their own field are sufficient for facilitating the rhetorical analysis in the activity.
All instructional materials for this activity—including an instructional guide, a student program and its implementation in code, and a template generator in Markdown and Python using Jupyter Notebooks—are available via a GitHub repository (https://github.com/addeldin/genre-generators).
There, you will find:
Bazerman, Charles. "Systems of Genres and the Enactment of Social Intentions." *Genre and the New Rhetoric*, edited by Aviva Freedman and Peter Medway, Taylor & Francis, 1994, pp. 67-85.
Ford, Paul. “What Is Code? If You Don't Know, You Need to Read This.” *Bloomberg*, Bloomberg L.P., 11 June 2015, https://www.bloomberg.com/graphics/2015-paul-ford-what-is-code/.
Hao, Karen, and Jonathan Stray. “Can You Make AI Fairer than a Judge? Play Our Courtroom Algorithm Game.” *MIT Technology Review*, 10 Jan. 2022, https://www.technologyreview.com/2019/10/17/75285/ai-fairer-than-judge-criminal-risk-assessment-algorithm/.
Miller, Carolyn. "Genre as Social Action (1984), Revisited 30 Years Later (2014)." *Letras & Letras*, 2015, pp. 56-72, doi:10.14393/LL63-v31n3a2015-5.
Nowacek, Rebecca S. *Agents of Integration: Understanding Transfer as a Rhetorical Act*. Southern Illinois UP, 2011.
Petzold, Charles. *Code: The Hidden Language of Computer Hardware and Software*. Microsoft Press, 1999.
Roberts, Siobhan. "Christopher Strachey's Nineteen-Fifties Love Machine." *The New Yorker*, 14 Feb. 2017, https://www.newyorker.com/tech/annals-of-technology/christopher-stracheys-nineteen-fifties-love-machine.
This activity takes place over two sequential in-class sessions. While the activity does not need to take up two full class sessions, the break is necessary so that the programs students design in groups can be implemented in code by the instructor and then shared back to students during the next session.
The first day of the activity should take between 50 minutes and 1 hour and 25 minutes, and the second day should take between 30 and 45 minutes. I have provided estimates for how long each part of the daily activities will take, but these may need to be adjusted based on instructors' sense of which parts students will struggle with.
Please note that this guide is just that: a guide. You are welcome to change it as you see fit for your classroom, and I would in fact love to hear about anyone doing so and how they went about the activity.
This instructional guide is available here as well as in the related GitHub repository ((https://github.com/addeldin/genre-generators), which further includes samples of student work for this activity and a Jupyter Notebook template for implementing student genre generators. If you wish to edit the instructional guide, I recommend downloading and editing `instructional-guide.md`.
Setup (estimate: 5-10 minutes)—
To begin, tell students about the overall arc of the activity, as related in the README.
Then, introduce students to the concept of *genre* from a rhetorical perspective rather than the more colloquial use. That is, talk about written genres students are likely to encounter in class—e.g. a non-fiction personal essay, a research paper, or an argumentative essay—and distinguish this understanding of genre from the broader use that distinguishes by narrative tropes, such as science fiction, fantasy, and westerns. Whereas the former is defined by the exigence for writing based on a specific context (generally, college writing assignments) and toward a specific audience (the instructor or an imagined community relevant to the discipline, such as attendees of an academic conference), the latter tends to focus on consistent narrative tropes and structures.
Prompt students to name written genres that fit this definition. If needed, provide some examples, such as emails to a professor, obituaries, recipe blog posts, news articles, etc.
Love Letters as a Genre (estimate: 15-20 minutes)—
The setup conversations lead directly into a rhetorical analysis of the love letter genre using sample outputs from Matt Sephton's implementation of the Strachey Love Letter Generator (https://www.gingerbeardman.com/loveletter/), which is useful because it only shows generated outputs. Show students several sample letters, and ask:
Then, ask questions that consider the rhetorical dimension of love letters more broadly:
Love Letter Generation and Code (estimate: 20-25 minutes)—
Remind students of the consistent features they identified when looking at the sample outputs of the Sephton iteration. Then, facilitate a conversation where students try to connect the word lists listed under `var` on line 4 to several outputs of the generator—e.g. how the words in `salutations1` and `salutations2` are, despite changing each time, consistently pulled from the two respective lists, which contain the opening salutation and pet name that follows it, respectively.
While the `for` loop that starts on line 45 might be harder to parse, look at the `else` statement on lines 52-54 and try to relate how the combination of "YOU ARE MY", a selection from a list called `adjectives`, and a selection from a list called `nouns` is reflected in the body of the sample letters.
Cap off this part of the activity by emphasizing the essential tools used to generate new love letters: text strings, lists of words that can be chosen from at random and inserted into a text string, and the use of variables in text strings to create differences between sample outputs.
Group Programming Exercise (estimate: 20-30 minutes)—
Break students into groups of between 4 and 6 students. If a subset of the class has experience with computer programming, distribute them evenly amongst the groups, as they might be able to guide how students enact their ideas into a conceptual program.
Ask them to respond to the following prompts in a collaborative written document and either turn in the paper or send their document to the instructor digitally at the end of class.
Emphasize that you will enact a selection of the student programs in code to present for the next class.
Identify 1 or 2 student programs that seem particularly viable to represent in code. For example, broadly described generator programs that do not contain lists or templates that interact with variables will require more labor on the part of the instructor to translate that program into code. While there are many potential approaches students can take, an ideal program for this activity will provide a basic string template, a list of words that is chosen from for parts of the template, and potentially variables that are called (e.g. the current time of day using the `datetime` module in Python).
Present text from the student document that states the chosen genre, the students who designed the generator, the description of that genre, and the key features they identified. Then, demonstrate the code that enacts the program with comments that explain what a given section is doing. The code should be presented in software that can run the code and present outputs along with the code, so that the generator can be run repeatedly to look at several different outputs.
For the materials included in this repository, I used Jupyter Notebooks to present text in Markdown in sequence with enactable code in Python. Please see `student-generator.ipynb` for an example, or `generator-template.ipynb` for a notebook that can be easily edited and added to by instructors.
Setup (estimate: 5 minutes)—
Briefly summarize the activity of the previous session, in particular for students who may have been absent the previous meeting.
Process Reflection (estimate: 5-10 minutes)—
Ask students the following questions to encourage them to reflect on their processes:
I used the final question as an opportunity to reinforce the broader idea behind the activity: programming is a conceptual process that mediates human goals and representations of the world and the digital technology that works with these representations in code. While their decisions had to account for the technical elements of digital technology, they were still making decisions about what a genre is, who it's for, when it's used, and what elements define it. They programmed by considering how to take their goals in defining a genre to generate new examples and make them work in the logic of digital technology. While the instructor does the actual coding, which is itself mediational, the focus is on how the students mediated human understanding and digital representation.
Genre Generator Presentation (estimate: 15-20 minutes)—
Show students the formatted text and code. Read through the name of the genre students chose, the names of the students who designed the generator, their description of the genre, and the key features they identified.
Relate a key feature to the code, which can generally be broken up for readability similar to the Vee implementation of the Love Letter Generator. For example, have all of the lists of terms in sequence, then the variables that choose from the lists, then the string template that makes use of the variables. If students identified that a salutation was important for an email to a professor, for example, then relate this key feature to the lists, variables, and place in the template that generate the salutation.
Show several sample outputs of the generator and ask students to identify which key features they can see in the outputs, and try to relate those outputs to what they can see in the code.
Rhetorical Analysis of the Genre (estimate: 10-15 minutes)—
Guide students through a rhetorical analysis of the genre as a mirror of the first session's discussion on love letters. You might ask about a number of specific features in the generator, but these general questions are useful starting points:
The final question I like to ask to reiterate the sociotechnical nature of the genre generators is: