1. Afterwards, there was still the command line
This past month, having just defended my dissertation, I found myself similarly needing to do some work, but not up to the challenge of literature. In one of my favorite passages from De Quincey’s Confessions, he claims that in the depths of his addiction, his thinking clouded by pain and intoxication, political economy helped him to convalesce:
In this state of imbecility I had, for amusement, turned my attention to political economy; my understanding, which formerly had been as active and restless as a hyæna, could not, I suppose (so long as I lived at all) sink into utter lethargy; and political economy offers this advantage to a person in my state, that though it is eminently an organic science (no part, that is to say, but what acts on the whole as the whole again reacts on each part), yet the several parts may be detached and contemplated singly.
In a similar situation, I decided to code something. Coding projects in my experience have a similar cognitive reward structure to what De Quincey describes of reading economics. Because computers do exactly what you tell them to, it’s hard, unless you’re working in a complex design environment, to go too far afield of your intentions. Contrary to the questions-based approach of traditional humanistic inquiry, I’ve found that programming, at my level of sophistication, either results in something that works, or doesn’t. Every once in a while, an error will be genuinely interesting, but that’s the rare exception. And so the modular thinking facilitated by programming allows me to test and re-test pieces and wholes in ways that keep me productively balanced in that flow state between feeling successful and feeling frustrated. In short, I find the work of coding to be qualitatively different than that of critical thinking. But that’s a far thing from saying that the end result of such work necessarily lacks a critical edge.
2. Critical bots
I’ve wanted to build a Twitter bot for a while, both because the Twitter API is where I first cut my teeth on processing large data sets, and because some of the work in this area I’ve found intellectually stimulating and politically inspiring. Mark Sample has a list of “protest bots,” which, in a post that inspired my title here, he defines as “topical, cumulative, data-based, and oppositional,” and, more importantly, “can’t be mistaken for bullshit.” In my opinion, the most medium-transforming protest bot is @every3minutes by the historian Caleb McDaniel at Rice. Caleb famously built a bot that tweets a variation of “A slave was just sold” every three minutes, which was the average time between such sales between 1820-1860.
In the antebellum American South someone just sold a person’s grandchild.
— Every Three Minutes (@Every3Minutes) May 28, 2015
This bot changes the entire Twitter experience: scrolling through status updates stops being a thoughtless passtime when, every few flicks of the thumb, you’re suddenly socked in the gut by a historical reality made immediate.
3. A political discourse bot
I attempted to build something slightly different — a public discourse bot, we might call it. It’s May 2015, and the 2016 presidential campaign is well underway. On the one hand, this is depressing because blah blah permanent campaign blah blah. On the other hand, it’s exciting because it is one of the few domains in which most (not all) Americans still have some say over policy: voting districts have been gerrymandered–and then some–out of existence, and the Supreme Court is openly flirting with disregarding the clear intent of what little the congress has passed. In other words, I think Presidential campaigns are a great opportunity for public discourse.
What I built, then, was an interactive Twitter bot based on a rudimentary keyword search engine. I scraped the congressional record for all of Bernie Sanders’ statements, and used NLTK to build a database of his keywords and phrases. I removed some of the passages that would be confusing when taken out of context (points of order, some letters read into the record, the details of some amendments, etc.), and after messing around for a while with the basic search algorithm and the output formatting, the senator’s congressional record had essentially been made interactive.
4. The Specifics
@SandersBot has two functions built in:
- If someone mentions him, he makes a weighted random guess as to which document in his corpus is the best fit, and, then the best passage in that document.
- If nobody talks to him for an hour, he reads what his friends are tweeting about, and tries to respond with the two sentences he thinks are most relevant to those topics.
And, because he was written for an academic, he always includes a link to the source material in the congressional record.
I’ve been surprised at how well he deals with basic policy questions:
Sometimes, of course, he misses his mark. But the other day, the bot did alright on Twitter’s version of the Turing test, when a couple users didn’t realize it was a bot account, and engaged it in an extended discussion. The bot responds to almost any mention, so replies to him can quickly prompt runaway threads. One person was a bit frustrated at how quickly the bot posted long, sometimes off-topic replies in her timeline; after I told her the replies weren’t coming from a human, she was very kind but said she wouldn’t use it again. Another person who engaged it at length didn’t seem to mind when I told him it was a bot, and came back to ask it a few more questions the next day.
I don’t know if this would work with every congressperson (though I did post an early version of the project’s code to github). What’s ironic about my choice of Bernie Sanders is that his vocal stance on specific issues is both what makes this bot functional and in many ways superfluous. Functional because his specific and expressive stances on policy questions makes the corpus so searchable and quote-worthy; superfluous because his clear stances on most issues makes them easy to find in any news search engine.
But at the same time, his regular tweeting schedule and always-on availability for questions stage less of an intervention than a contribution to political discourse. At the end of the day, the bot is supposed to be like C-SPAN having a dream about social media: it tries to blend the dusty text of the congressional record, and the day-and-night pulse of Twitter. This bot tries to make the politics of congress accessible to one of the most politically rich communications platforms we have today.
 I was inspired here by one of my students, who this semester submitted a truly compelling final project that took William Wordsworth’s poetic corpus, and scrambled the lines into believable simulacra using Markov chains and Natural Language Processing.
 If anybody is interested, I started processing Hillary Clinton’s congressional corpus but decided I’d given enough time to the project as a whole. I would be happy to send you the files.