Building a Princess Bride tweeting machine

Emeraq, a movie-loving bot, has the job to look out for and respond to tweets of choice movie quotes.
Written by Daniel Terdiman, Contributor

"Hello. My name is Inigo Montoya. You killed my father. Prepare to die."

If that line, from movie The Princess Bride seems familiar, you're not alone. You may even have tweeted it at some point. After all, every day as many as a dozen people do just that.

And every time someone does, somewhere on the internet a web robot sees it and fires back its own line from the movie.

This is Emeraq, a movie-loving bot whose job consists of nothing more than looking out for and responding to tweets of choice movie quotes.

I discovered Emeraq by accident last weekend, after watching The Princess Bride. Unable to resist, I tweeted Inigo Montoya's famous line and was shocked when less than 20 seconds later, I got a reply from Emeraq quoting another line from the movie. "I'm starting to lose confidence," @emeraq tweeted. "I just work for Vizzini to pay the bills. There's not a lot of money in revenge."

What was amazing was how quickly the reply had come. My first thought — which I quickly rejected — was that it was an auto-response. But that idea seemed too farfetched. Instead, I was just impressed that someone had not only seen my late-night tweet, but had been able to fire off the @ reply, with perfect memory, in about 20 seconds. Maybe less.

Still, I decided to look up the profile for @emeraq — and that's when I met the "Electro-Magnetic Memory and Research Archive Quote machine."


Emeraq is the brainchild of Michael Kowalchik, a Boston-area entrepreneur and co-founder of a company called Starterer. In an email, he explained that he started Emeraq while he was between projects, and wanted to try building something using Twitter's API.

"I was mostly inspired by the way my friends and I often quote movies," Kowalchik said. "One person will 'tee up' a quote and a second friend will quote something similar, continue the scene or finish the quote. While I think it's a behaviour we all share, it's a particularly common feature of geek culture. I thought it would be fun to try and bring a little of that experience to Twitter."

That was 27,000 tweets ago. For the last year and a half, Emeraq has been sitting out on the internet ready to weigh in on Twitter users' movie nostalgia. At first, the bot would jump into action when quotes from 15 different movies made their way through the tweet stream — but Kowalchik said that because of limitations in Twitter's streaming API, he's now culled that list to four films — The Princess Bride, Ghostbusters, 2001: A Space Odyssey and Better off Dead.

"The first version used the Twitter-search API, and searched the stream every 30 minutes or so, looking for hits," Kowalchik explained. "The impact was lessened when Emeraq would respond to someone 30 minutes or more after they tweeted, and the continuity of the shared quote 'experience' would be broken."

That's why the current version watches the stream in real time for specific triggers. "Emeraq collects candidate matches, and does a couple of second pass filters of those matched real-time tweets to match the intended quotes," Kowalchik said. "It has to be fuzzy enough to match people who don't quote verbatim, but not 'misfire' and respond to things that aren't really quotes."

Emeraq is currently set up to respond to about 50 different lines from the four films, and each quote can generate about four different replies. Of the four movies that the bot recognises, lines from The Princess Bride are by far the most commonly tweeted. On the other hand, the most commonly tweeted movie quote of all, he said, is from Ghostbusters: "Dogs and cats, living together, mass hysteria!" Emeraq has responded about 5000 times to that quote alone.

In the future, Kowalchik said that he hopes to expand the number of films Emeraq tracks, but it will take some engineering work to overcome the limitations of the Twitter-streaming API. His database already contains plenty of quotes from other films, and he may even let movie fans suggest lines to add.

When the project was just getting started, Kowalchik was concerned that Emeraq's unsolicited responses would seem "spammy" to people, but he abandoned that worry when he began getting good feedback. "The number of positive responses significantly outweighed the complaints or confusion," he said.

That's something that Twitter user Katie Higgins would agree with. Yesterday, like several others, she tweeted the famous Inigo Montoya line, only to see Emeraq's instant (and appropriate) reply: "I do not mean to pry, but you don't by any chance happen to have six fingers on your right hand?"

I asked Higgins what she thought of Emeraq. "I didn't have a reaction, because I didn't know it was a robot," she said. "It's amazing. I already texted a friend of mine [that] I want a robot. Its comment was very funny."

Indeed, sentiment like that is what keeps Kowalchik interested in maintaining his project. It's "fascinating to see how people interact with technology," he said. "I went out of my way to make sure that Emeraq represents itself as a machine, a Twitter robot, yet sometimes people engage in (sometimes lengthy) discussions with it. Mostly I enjoy how it seems to bring a bit of goofy happiness to people's lives. My favourite moments are when Emeraq goes back and forth with someone on Twitter trading quotes, sometimes four or five in a row."


Editorial standards