Sentiment Analysis of Stock News Using VADER

What is Sentiment Analysis???

Sentiment Analysis, or Opinion Mining, is a sub-field of Natural Language Processing (NLP) that tries to identify and extract opinions within a given text. The aim of sentiment analysis is to gauge the attitude, sentiments, evaluations, attitudes and emotions of a speaker/writer based on the computational treatment of subjectivity in a text.

Sentiment analysis is a machine learning technique that detects polarity (e.g. a positive or negative opinion) within text, whether a whole document, paragraph, sentence, or clause.

Example Of Working Of Sentiment Analysis

Why is Sentiment Analysis so important??

Businesses today are heavily dependent on data. Majority of this data however, is unstructured text coming from sources like emails, chats, social media, surveys, articles, and documents. The micro-blogging content coming from Twitter and Facebook poses serious challenges, not only because of the amount of data involved, but also because of the kind of language used in them to express sentiments, i.e., short forms, memes and emoticons.

Understanding people’s emotions is essential for businesses since customers are able to express their thoughts and feelings more openly than ever before. By automatically analyzing customer feedback, from survey responses to social media conversations, brands are able to listen attentively to their customers, and tailor products and services to meet their needs.

Sentiment Analysis is also useful for practitioners and researchers, especially in fields like sociology, marketing, advertising, psychology, economics, and political science, which rely a lot on human-computer interaction data.

Why Sometime Sentiment Analysis Becomes Hard to Perform??

Though it may seem easy on paper, Sentiment Analysis is actually a tricky subject. There are various reasons for that:

  • Understanding emotions through text are not always easy. Sometimes even humans can get misled, so expecting a 100% accuracy from a computer is like demanding something which is completely impossible.
  • Computers aren’t too comfortable in comprehending Figurative Speech. Figurative language uses words in a way that deviates from their conventionally accepted definitions in order to convey a more complicated meaning or heightened effect. Use of similes, metaphors, etc qualify for a figurative speech. Let us understand it better with an example.

“The best I can say about the movie is that it was interesting.”

Here, the word ’interesting’ does not necessarily convey positive sentiment and can be confusing for algorithms.

  • Heavy use of emoticons and slangs with sentiment values in social media texts like that of Twitter and Facebook also makes text analysis difficult. For example a “ :)” denotes a smiley and generally refers to positive sentiment while “:(” denotes a negative sentiment on the other hand. Also, acronyms like “LOL“, ”OMG” and commonly used slangs like “Nah”, “meh”, ”giggly” etc are also strong indicators of some sort of sentiment in a sentence.

VADER Sentiment Analysis

VADER (Valence Aware Dictionary and sEntiment Reasoner) is a lexicon and rule-based sentiment analysis tool that is specifically attuned to sentiments expressed in social media. VADER uses a combination of A sentiment lexicon is a list of lexical features (e.g., words) which are generally labelled according to their semantic orientation as either positive or negative.

VADER has been found to be quite successful when dealing with social media texts, NY Times editorials, movie reviews, and product reviews. This is because VADER not only tells about the Positivity and Negativity score but also tells us about how positive or negative a sentiment is.

Advantages Of Using VADER

VADER has a lot of advantages over traditional methods of Sentiment Analysis, including:

  • It works exceedingly well on social media type text, yet readily generalizes to multiple domains
  • It doesn’t require any training data but is constructed from a generalizable, valence-based, human-curated gold standard sentiment lexicon
  • It is fast enough to be used online with streaming data, and
  • It does not severely suffer from a speed-performance tradeoff.

Let’s begin with the code:

  1. Importing the libraries required for our Sentiment Analysis

2. Parsing Finviz Article Data with BeautifulSoup

3. Manipulating Article Data with Pandas

For Amazon Only

4. Parsing Data for all the Tickers(Amazon,Google,Face Book)

Accessing all Stock news with there date and time

5. Applying Sentiment Analysis on Article Headlines

6. Best part of our Project that is Visualization of Sentiment Analysis with MatPlotLib

Sentiment Analysis of Stock News for Amazon,Google,Face Book

The source code of this is available on my github repository.

For any queries related to my project contact me over my email id: powerakash8@gmail.com

Closing Note: I hope this blog will help you to build your own Sentiment Analysis System.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store