After noticing that Google search was returning far more love poems by men than women, I decided to look into what computers understand about love. Although love is generally considered a positive thing, some love poems speak to heartbreak and loss. Could my computer tell the difference?
Few, if any, love poems resemble the movie reviews and tweets I’ve seen analyzed for sentiment in the past, but I thought sentiment analysis might prove useful--or at least interesting. Often used to sort positive from negative reviews, we turn to sentiment analysis to determine whether or not a person loves their new toaster. Why not apply it to poetry to determine whether a person is IN love or falling out of it?
I admit that love is more complicated than a toaster, and that sentiment analysis was not designed with poetry in mind. And yet, nowhere did I see a warning DO NOT USE ON LOVE POEMS, and so, I figured, why not try and see what happens?
The love poem carousels on this page feature the results of this project.
Romance should never begin with sentiment. — Oscar Wilde, An Ideal Husband
While I was reading the love poems in my collection of 1000 poems, I noticed that some poems dealt with the joy of falling in love and others with the pain that comes with the death of a loved one or a betrayal. I wondered if a sentiment analysis—-which is used to indicate how positive or negative a text is—-could help identify which love poems were happy and which less so. My goal: to create a ‘positive love poem carousel’ with the most joy-filled of the love poems, and a ‘negative love poem carousel’ for those seeking more morose work.
For this project, I decided to try Google’s sentiment API. The API returns two numbers for each poem: score and magnitude. Sentiment scores range between negative and positive one and correspond “to the overall emotional leaning of the text.” Magnitude “indicates the overall strength of emotion (both positive and negative)” and ranges from 0 to infinity.
I tested the system out on Jessie Redmon Fauset’s poem “Douce Souvenance” and discovered that line breaks make a difference in the score. For example, without line breaks, “Douce Souvenance” is analyzed as four sentences, three of which end with an exclamation point. The sentiment is positive (.3 on a scale that ranges between -1 and 1), with a magnitude of 2.6. When I broke “Douce Souvenance” into lines—more like how the text appears on the printed page--the overall sentiment came back as 0 with a magnitude of over 6.
I couldn't decide whether I should approximate the line breaks and score the sentiment that way, or allow the sentiment analyser to break the poem up in the way it best understood text--by sentence--so I tried both ways.
Meanwhile, I used the online API demo to do a few experiments on individual words from “Douce Souvenance:”
"And seek the dim past where my memories stay." [ score: 0, magnitude: 0 ]
I was curious about how the scores were calculated, but I didn't see any information about this--at least not in the documentation I came across.
After analyzing all 1075 of the love poems, I found that the average sentiment for the set was just below zero (both when I tried using line breaks and without them; however, the scores for each poem were often quite different). I was a little surprised that the average sentiment was so low, but mostly, I was interested in the poems that were most positive and negative—-and these are the love poems I placed into the love poem carousels. Each carousel contains a random selection from the top fifty poems on either the most positive or negative end of the sentiment spectrum. Reload the page to see a new set, and see if you agree! Keep in mind that, when it comes to sentiment, reports note humans only agree among themselves 79% of the time.
See more poems and images in the Love CarouselsTweet