Article Lead Image

Illustration by Max Fleishman

How an Internet comedy legend coded a program to make humans laugh

Can a machine have a sense of humor?


Jay Hathaway

Internet Culture

Posted on Apr 14, 2016   Updated on May 26, 2021, 10:53 pm CDT

Jamie Brew, formerly of satirical newspaper the Onion and currently the head writer of its even funnier offshoot, ClickHole, is one of the few people worth following on Twitter. His account has become a collection of very good parodies—of everything from The Bachelor to storied grammarian William Strunk Jr.—created with software of Brew’s own design. 

Early successes for Brew and his predictive text emulator included send-ups of January’s presidential debates, both GOP and Democratic: 

From there, he moved on to recipes …

… an X-Files script …

… a Strokes song, with an accompanying recording on Soundcloud

… and Craigslist ads.

His latest work is a three-act play based on the transcripts of professional eater Anthony Bourdain:

If software has a natural place in comedy, it’s in taking source material with a predictable format and producing highly structured gags like these. The core of the joke lies in all Craigslist ads (or debates, or episodes of The Bachelor) being basically the same. We’ve established such clear conventions and expectations for these websites, events, and TV shows that an algorithm can convincingly emulate them. 

But another part of the joke stems from the words themselves: They have to be convincing takeoffs of the source material, but not too convincing. The ideal joke should fall right into the uncanny valley—an alien version of each speaker, emphasizing their weirdest qualities. 

Brew’s jokes consistently hit this sweet spot. 

“What do you think is the most ferocious thing I have eaten in my mouth?” asks his bizarro Bourdain. “This neighborhood has long been waiting for me to eat it. This beautiful mountain of food is a sacrifice to make me happy.” 

It’s all so good and so funny. So how could a bot pull it off? Nerds on Tumblr wondered about that, too, and even speculated about whether Brew’s seemingly magical app was real at all.

Brew’s parodies were “way funnier and more grammatical than usual Markov chain output, which is what computer-generated text on the Internet usually is,” wrote Nostalgebraist.

Given that Brew had said on Twitter that he was “newish to coding,” Nostalgebraist was “skeptical that he’s actually producing these with a computer.” They tagged the post “i would like to be proven wrong about this.” 

A little more than a month later, they were. 

Brew may have been newish to coding—he told me he took one course in college, and learned Python specifically for this project—but his predictive text emulator was real. He posted the source code, along with a detailed explanation of how it works, on GitHub. 

Brew is indeed developing his great jokes with a computer, but not without a lot of his own input. There’s a reason Brew calls his project a “predictive text emulator,” not a bot.

“It’s a program that tries to replicate my Android phone’s predictive text function as best as it can, but for specific source material,” he said. “I’m talking about the word suggestions that appear at the top of the text entry interface (my phone offers three options, which seems to be standard). If you repeatedly accept one of these suggestions, you can usually write semi-coherent sentences like (pulling my phone out now): I will send a direct flight from London to Paris France in my opinion of course.”

So Brew picks a corpus of words for his program to chew on—Every Available Anthony Bourdain Transcript, for example—then clicks through the suggestions it spits out, building sentences until he gets something good. Something way funny and semi-grammatical.

And, although the software provides the word choices for him, it still takes some heavy editing to arrive at the polished examples he posts on Twitter.

“With the longer pieces, I almost always rearrange the completed sentences. The program has no semantic notion of anything broader than the most recent two words (yet) so it’s rare to write sentences that flow directly into each other,” Brew told me. 

“Less often, I go into a sentence and try to find a different ending that I could have reached on the first pass. The key rule I follow is that any complete sentence in the final output must be possible to generate using only the program’s suggestions.”

Sometimes it works, and sometimes it doesn’t. When a joke has a ton of source material—like every Craigslist post in Chicago—almost everything that comes out of the app is gold. With smaller projects, like the William Strunk parody, Brew has to be a lot pickier. 

“The Elements Of Style is a tiny 48-page book. With that one, at a certain point you start to feel like you’ve visited all the interesting words in the source and tried out some of the most promising paths from those words. So, diminishing returns there. I’d estimate the ratio of discards to selects with that project has increased from about 1:1 in the early going to more like 4:1 these days,” Brew said.

In a recent piece called “Some Strategies of Bot Poetics,” poet Harry Giles calls Twitterbots “the most important development in contemporary poetry.” Although Brew’s tweets aren’t produced by a bot, his process has several of the advantages Giles finds promising in Twitterbots.

“It’s important to recognize that the technical basis of a bot often determines its aesthetics—new bases, we can surmise, will allow for new aesthetic possibilities,” Giles wrote. 

What Brew gets out of his text generator is wildly different than what he would get out of pure Markov chains or recurrent neural networks. But it’s also different from anything a human writer, faced with infinite word choices, would produce on his own. 

Part of the poetry of software, Giles notes, is its capacity to produce “strangeness and surprise.” Brew’s work shows that goes for the comedy of software, too. The difference is that bots can’t (at this stage) decide which strange and surprising things will be funny to an audience of humans—it still needs a good editor.

“A big thing that computer programs don’t have access to (I hope) is the immediate visceral reaction that a joke or sentence or piece of art provokes,” Brew told me. “The editing stage, whether you’re talking about a finished draft or the constant self-editing you do as you write.” 

“Like, OK, you’ve followed some rules and drawn on some influences and you have this sentence… does it work?” 

And when a computer’s editor is the head writer for one of the only consistently funny websites in the world, the jokes work a lot of the time. 

Humans: still funny, not yet obsolete. We may have had our asses kicked at Chess and Go, but at least we have this. 

Share this article
*First Published: Apr 14, 2016, 11:00 am CDT