Birmingham on Rails 2020

What's Love Got To Do With It? Ruby and Sentiment Analysis

What's Love Got To Do With It? Ruby and Sentiment Analysis

by Ben Greenberg

The video titled "What's Love Got To Do With It? Ruby and Sentiment Analysis" by Ben Greenberg explores the intersection of human language, sentiment analysis, and natural language processing (NLP) using Ruby as a foundation. Greenberg begins by discussing the significance of language, emphasizing that it is not merely a means of conveying information but actually shapes our thoughts and perceptions. He provides examples from different languages to illustrate how linguistic structures can reveal more than just the surface meaning of sentences. For instance, he contrasts English with Hebrew, highlighting how gendered language influences expression and thought.

Key points discussed in the video include:
- The relationship between language and thought, stressing that language influences not just communication but the way we conceptualize our experiences.
- An introduction to NLP and its components, particularly sentiment analysis. Greenberg discusses how algorithms analyze language to assess sentiment polarity and identify emotional tones.
- Different types of sentiment scoring, exploring examples like the emotional complexity of people’s statements, and the challenges machines face in understanding sarcasm and contradictions in language.
- The creation of a practical application, "Mood of the News," which evaluates the sentiment of news headlines to help users gauge whether it's safe to engage with the news that day. This application uses various APIs including News API, IBM Watson for NLP, and Next Mode for communication.

Throughout the talk, Greenberg emphasizes the importance of understanding data in sentiment analysis, pointing out discrepancies between emotional scores and sentiment. He explains that journalists often try to balance positive and negative sentiments in their reporting, which can lead to complex emotional expressions.

Conclusions and takeaways include:
- The notion that understanding human emotions is crucial in algorithmic development for better natural language processing.
- A call for developers to examine their data critically and to recognize contradictions in language, reinforcing that machines might not fully grasp human thought processes yet.
- A resource recommendation section with articles and books for further exploration of the topics covered.

Greenberg closes the presentation by connecting back to Alan Turing’s vision of machine intelligence, questioning whether current machines can truly think like humans, and encouraging the audience to reflect on this question.

Overall, the presentation emphasizes the complexity and beauty of language, the utility of sentiment analysis in technology, and the insightful applications that can arise from understanding human emotion through language analysis.

00:00:16.540 Yeah, how's your day been so far? I see that thumbs up. I see a great few nods. It's three o'clock now, I know it's that time of the day, so I'll try and be a little more energetic than normal. I just had another cup of coffee; I'm only on number seven, so I think we'll be okay. I apologize for taking the last cup of coffee from the urn. So, we're going to talk about Ruby and sentiment analysis: what's love, what's hatred, what's anger, what's joy, and what's sadness?
00:00:25.289 What's it got to do with it, right? Creative title. But before we get started on that, who am I? As I mentioned, I am Ben. I'm a second-career developer. Are there any second-career developers here? Any bootcamp attendees? Yeah!
00:01:04.140 So, I spent a decade as a rabbi and community organizer throughout the U.S. You know, you move around often, even if you're working in the military or in the clergy. I've lived in San Diego, New York City, Boston, and Denver. I've seen a lot of different expressions of sentiment and the way people spread their sentiment.
00:01:10.080 I now live outside Tel Aviv in Israel, and I am a developer advocate at Nexmo, the Varnish API platform. We have a suite of cloud communications API platforms. You might have seen my stickers and coupon cards around on the tables.
00:01:16.860 We have a great Ruby gem that I maintain; I think it's pretty awesome. So, that's a little about who I am.
00:01:23.130 Now, what are we going to do together today? We're going to take a high-level approach to understand why this entire conversation matters. Why is it important to invest the time in understanding the contours and shapes of human language?
00:01:28.229 To do that, we're going to take a little adventure into linguistics, into the nature of human language. It's going to be a little bit of a detour from coding and more about how we code our thoughts and the ways in which we speak to each other.
00:01:34.200 From there, we’ll discuss natural language processing, what it is, what is happening, and the rules that inform the algorithms that perform these tasks. As a subset of that, we’ll also look specifically at sentiment analysis.
00:01:40.320 Then, we’ll ask, now that we know what these things are, what can I actually do with them? What can I build to gain insights into the world we live in? Lastly, we’re going to build something together, run it, analyze the data, and see what comes back from that analysis.
00:01:46.829 Does that sound good? Yeah? Okay, let’s actually get started.
00:01:52.079 We've got that big question: why does this matter? Why shouldn't I just walk out of here and get some candy from the sponsor out there?
00:01:58.740 Well, to answer that question, we need to start with a significant claim: human language is not just a passive vehicle for information. What I mean by that is language is more than a conveyance from person X to person Y. It's more than just a transmission of data.
00:02:06.130 Language shapes the ways we think. It shapes what we think we ought to think about. Does that make sense? I'm going to give you a couple of quick examples before we dive into the rest of our conversation together.
00:02:12.489 One example might be a casual water cooler conversation. You and your friends are standing around the water cooler, and you say, 'Last night, I had dinner with someone. It was delicious.' Pretty simple English sentence, right? Not too complicated.
00:02:18.430 In that sentence, what I'm choosing to reveal as an English speaker, I'm revealing that I had dinner with someone, but what I'm not revealing is guided by the rules of the language I'm employing.
00:02:23.440 Another example would be the same sentence in Hebrew. If you don't know Hebrew, what would that look like? It would say, 'Last night, I had dinner with a male someone, and she was delicious.' Why do I need to do that? Because many languages in the world have gender assignments for proper named entities.
00:02:29.680 So, in Hebrew, 'dinner' is a feminine word. You can't just refer to it as 'it.' It has to be either a he or a she. Thus, I must refer to the person I had dinner with regarding their gender, which introduces nuance.
00:02:36.610 One last example is how we see ourselves in the context of our physical environment. Imagine I'm telling you how to get to the coffee shop down the street from the McWane Science Center.
00:02:42.370 As a speaker of English, I might say something like, 'You go out the door, pass the popcorn stand on your right, and then make a left and another left followed by a right, and it will be right in front of you.' Pretty reasonable, right?
00:02:48.760 However, if I speak a language that relies on cardinal directions, I might say something like, 'You go out the door, go north, then take a west, another west, and then it's at the southeast corner.'