Valentine’s Day 2013: What Twitter Thinks About Love

Every year, I create some sort of computer art project for Valentine’s Day. This year, I created another video, and I think this may be the coolest one yet.

Two years ago, my video was an attempt at capturing the spirit of valentine’s day by processing a video I took on my bus ride to school. I wanted to go back to that theme this year, but the whole “searching for colors thing” was played out. This year, I decided to get my computer to describe love.

Basically, I had my computer suck down every tweet on Twitter for a certain time period that had the word “love” in it, and then processed it, looking for the most common chains of words. I did this using a method called Bigram Probability, which basically calculates the probability of one word coming after another in a sentence. The more often the word “you” comes after the word “love”, the higher the probability assigned to the word “you” coming after “love.” It’s simple enough, but it produced some beautiful results.

Because of this method’s simplicity, I had to do a little “post processing,” which involved taking out the garbage sentences that the program produced. In the end, this became “picking the good ones.” Now, that’s not to say that I’m only picking the cute ones. No no, I’m picking the ones that are grammatically correct; the computer is doing the cute all by itself. Or rather, Twitter is.

Then I shot some video of a hike to the top of the mountain (story after the video,) added the text over it, and set the whole thing to some awesome music by Broke For Free that I found on Free Music Archive.org.

Before we get to the video, let’s have some stats. Of all the words the computer processed, the most common (other than love, which was the search query,) was “I”, and the next most common was “you.” Starting with “I”, the sentence with the highest probability was “I love you”. (D’awwwww.) The most common word after “you” was “love,” but if we ignore that one (because it creates an infinitely cute loop of infinite “love you”s),* the next most common sentence was “I love you too.” And if you think it’s cute that the sentences with the highest probability resulting from a search for the word “love” on Twitter are “I love you” and “I love you too,” wait until you see the ones I used in the video.

Note that the video is a bit shaky. If I had a better camera and/or a Steadycam, I might have been able to record more stable footage, and track the text better. The music is by Broke for Free.

A Story

As I walked up the mountain, I was honestly worried that the video would be a little boring. The computery stuff is cool, and I love playing with video editing sofware, but my idea for the background footage seemed a bit boring. Fate brought me the heart-shaped balloons in the trees, which I thought was a pretty cool end to my journey. But actually, that was the beginning of a different, far more exciting journey.

Coming from the direction of the heart-shaped balloons (make of that, symbolically speaking, what you will,) I heard the song “If I Had a Million Dollars” by the Barenaked Ladies. It seemed to be coming from the woods, but I had no idea who would be playing music that loudly near the park. I thought about trying to find it, and then decided against it. As I was leaving the great patio that forms the lookout on the mountain, something turned me back. Where’s my spirit of adventure, I thought to myself. So I turned about face, and I went in search of the music.

Because I value the integrity of my limbs, I decided against filming my hike through the woods and snow, which took place entirely off the paths in the park that are maintained during the winter (the first thing I did was boot-ski down a staircase that was “closed for the winter”) and mostly off the few paths beaten into the snow by other daring travelers.

I ran through the woods, slid down slopes, and hung on to trees. It was an exhilarating feeling. I’ve always loved running through the woods, and I haven’t done it in a long time. Every so often I would stop, prick my ears, and listen for the music. Sometimes it would fade out, and I had to try to head toward where I thought it had been the last time. My best guess is that someone had set up an outdoor skating rink, as towns and schools commonly do in Quebec during the winter, and that they were playing music for people skate to. But I didn’t come across a skating rink.

Eventually, I reached the road. There was no sign of the music, or where it was coming from. I knew where I was, and I had an appointment in an hour and a half, and I thought I’d head back. The adventure was fun, and I had gotten something out of my search, even if I hadn’t solved my puzzle. So I started walking home, and after a block or so, the music piped up again. It was louder this time. I could tell that it was bouncing off the buildings, so it was hard to say exactly where it was coming from. I hesitated, then took my best guess and started after it again. As I walked down the street, the music got louder, and louder, and louder, until I could finally see where it was coming from.

It was coming from a protest at the Montreal General Hospital. One of the unions there is on strike, and they were picketing and playing music. My mystery music was coming from an amp strapped to the back of a pickup truck. The mystery was solved.

It’s amazing how, sometimes, if you look hard enough, life gives you exactly what you want. I was cranky that day, my mood sharpened by not wanting to get out of bed, and my usual frustration with the commercial assumption that all people everywhere are paired off on Valentine’s Day. Something was telling me, right before I had started my trek, that life was holding out exactly what I needed at that moment. And whether you believe in fate, God, synchronicity, or probability, I felt that one or all of them were giving me an opportunity; a free pass to improve my mood and learn something.

The lesson I learned (or relearned) is this: what you’re looking for is out there somewhere. It applies very well to those of us who are single during this season, and to love, but it also applies more generally to any other pursuit in life. You’ll hit rough patches, you’ll get lost, you’ll have fun, you’ll face adversity, and maybe you’ll even give up a few times, but if you keep your ear to the ground and your goal in mind, you’ll find what you’re looking for eventually.

*Those familiar with bigram probabilities will probably realize that there shouldn’t be repeats. However, the data structure I used to store the bigram probabilities made the usual manner of iteration somewhat difficult, and I wanted to allow some repeats.

Advertisements

2 thoughts on “Valentine’s Day 2013: What Twitter Thinks About Love

  1. Hi,

    Overall I enjoyed the Valentine’s day video (I didn’t think it was boring but realistic 🙂 ) but I was wondering what was really written in the trees that time when it says “Hi I just to say I love you” I’m not sure if something’s missing or if I read it wrong…? I enjoy reading your blogs and I find it funny how you got rid of the tweets that didn’t make sense as they were grammatically incorrect 🙂 I would have done the same thing!

    Take care 🙂

    • Hi, and thank you for commenting! I’m glad that you enjoy reading my blog, and that you enjoyed my video! The text in the trees says “I just say hi to say I love you.”

      Actually, these were all computer generated based on the probabilities of words occurring at a certain point, so they’re not actually tweets. But true to form for the Internet, the vast majority of the sentences it generated were grammatically nonsensical.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s