Massaging McLuhan

I’ve made one of my goals for the year—call it a New Year’s resolution, if you’d like, but of the variety that happens in late-February/early-March—to learn how to program generative texts. I’m hoping that this will eventually lead to longer-form poetry, but I decided at first to start with small, simple projects, like Twitter-bots, as they provide a good opportunity to learn more about the basics of textual processing, while at the same time having a smaller scope than longer-form poetry.

My first Twitter-bot was @tonightiate, a bot that announces random nouns that it’s “eating.” While it works well, the coding was quite sloppy, and a lot of the functionality was “hard-wired” in, quite difficult to expand. With my new bot, I wanted to remedy this, making something that could be expanded in scope with ease.

Subject-matter-wise, I thought it might be interesting to create a bot that reworked the text of a famous author. I’ve been really enjoying Leonardo Flores’s series of essays on Twitter-bots, and wanted to create something along the lines of what I’ve seen there. I decided that the subject of my bot would be Marshall McLuhan. I’d actually meant to make a McLuhan bot a few years back, and created an account—Martial McLuhan—for that reason. Unfortunately, I… uh… just plain forgot how to log into that account. Whoops.

Since I couldn’t log into my old account, I created @massagemcluhan, a bot that would “massage” McLuhan’s quotes—work them over completely, as McLuhan would say. I’ve noticed McLuhan’s penchant for reworking and revisiting phrases (“the medium is the message” and “the medium is the massage” being the most famous), and thought it would be interesting to rework some of these phrases by substituting various nouns into them.

The Python code I developed is as follows (with all my Twitter info redacted):

import tweepy
from random import choice
from random import randint
import time

#set up the OAuth and twitter API
consumer_key = '[redacted]'
consumer_secret = '[redacted]'
key = '[redacted]'
secret = '[redacted]'
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(key, secret)
api = tweepy.API(auth)

#set up variables and seed all the random text arrays
noun = ''
words = [line.strip() for line in open('Nouns(5,449).txt')]
mcluhanquote = [line.strip() for line in open('mcluhanquotes.txt')]

#main loop
while True:
   noun = choice(words)
   quote = choice(mcluhanquote)
   #if the quote starts with a variable, capitalise the variable
   if quote[0] == '%':
      twitstatus = quote % (noun.capitalize())
      twitstatus = quote % (noun)
   #tweet the status

As you can see, there’s actually very little that happens here—the majority of the code is actually just setting up the Twitter API. Aside from that, my program draws a random quote from a file and a random noun from another file, then combines the two. The quotes all have one of the nouns replaced with a variable, and look like this:

Let us return to the %s.
The %s is the message.
The medium is the %s.
%s escapes attention as a communication medium just because it has no "content"
It is impossible to understand social and cultural changes without a knowledge of the workings of %s.
%s offers yesterday's answers to today's questions.

I’m hoping to expand this to allow for more complex substitutions/manipulations, but for the time being, this is working well, and I’m rather happy with the results.

In The Medium is the Massage McLuhan (or Quentin Fiore, or Jerome Agel, or someone) writes “When two seemingly disparate elements are imaginatively poised, put in apposition in new and unique ways, startling discoveries often result.” This notion seems to bear out in @massagemcluhan, where a number of genuinely thought-provoking utterances have emerged from this random process. Consider the following tweet:

When I was young, I remember visiting some student archaeologists on summer vacation (we were near an active dig site, and my parents, quite wisely, though we’d find a visit interesting). One thing that stuck with me is the usefulness of garbage: nothing can teach you about a society and culture quite like that which they throw away. A midden heap contains a wealth of information, and is most certainly a communication medium.

Another tweet that rings particularly true is this one:

What is data if not yesterday’s answers? And we so readily consult them, searching for the answers to today’s questions.

I look forward to working with this bot a bit more, as I think it has a lot of room to grow. It’s helpful, too, that the results are so interesting, making it well worth the while. I would love to hear everyone’s thoughts on this, especially comments on the bot itself—this is only my second one, so I have a lot to learn, and I appreciate all the advice I can get..

Citing HTML Articles

Recently I was discussing the citation of articles that have been posted in HTML with my fellow PhD students Peter Buchanan and Michael Donnelly. Once upon a time, the MLA had us number each paragraph, but that practice has been removed in the most recent citation standards. It makes good sense, too, as counting paragraphs in any work of of substantial length is a painful task, and for the most part it’s easy to tap ctrl+F and find the reference straight away.

But sometimes this new system doesn’t work terribly well. For example, if you’re trying to find a common phrase in a long document, you may find yourself searching for some time. Likewise, a paraphrase can prove fiendishly difficult to track down, as it could be substantially transformed from the original expression.

The metadata that paragraph numbers provide can also prove quite helpful in helping you situate the arguments spatially within the text. Is this an argument made early in the article, or perhaps towards the conclusion? Are these two pieces of evidence presented close to one another in the article they’re cited from, or have they been brought together by the author who is citing them? Did this I’m marking student engage with the entire article, or did they pick all their citations from the introduction? With paragraph numbering, we can more easily answer some of these questions at a glance.

With this in mind, it occurred to me that it would be easy to solve this using a tool available in all modern web browsers: bookmarklets! Using a bookmarklet, we can automatically add numbers to each of the paragraphs in any given website, without that website’s author having to make the changes themselves. If we visit a site and click the bookmarklet, the paragraph numberings will all appear automatically. If you cite paragraphs according to this numbering, any reader can visit the site and run the same bookmarklet to get the same paragraph numbers. This is an easy, minimally-intrusive way to get add the metadata we need to effectively and efficiently cite website content.

I encourage you all to try this yourselves. Simply drag this below link to the bookmark bar of your web browser. When you visit an HTML-based article, just click the bookmarklet in your bookmark bar and the paragraph numbering will appear on all the paragraphs in the article, available for easy citation.

Bookmarklet:   MLA Paragraph Tagging  

Please do let me know what you think, either in the comments or by tweeting me at @mattlaschneider..