nlp

nlp / SocialSentimentAnalysis / 0.1.4

README.md

0. TL;DR

This algorithm takes an English sentence and assigns sentiment ratings of "positive", "negative" and "neutral".

1. Introduction

Identify and extract sentiment in given English string. Sentiment analysis (also known as opinion mining) refers to the use of natural language processing, text analysis and computational linguistics to identify and extract subjective information in source materials.

Input:

  • (Required):  String sentence* or A list of strings**

Output:

  • Sentiment* of given sentence(s).
*Note: 4 sentiment types are returned: Positive, negative, neutral & compound. The first three sentiments scale from 0 to 1. Compound sentiment is the overall sentiment, where it scales between -1 to 1, negative to positive respectively.

2. Sentences

*String sentence: A sentence. (key = "sentence")

Example of String Sentence:
{
  "sentence": "I really like this website called algorithmia"
}

or

"I really like this website called algorithmia"
**A list of strings: A list which contains at least 1 string sentence. (key = "sentenceList")

Example List of Sentences:
{
  "sentenceList": [
    "I like to fly",
    "I hate waking up early",
    "I enjoy eating Italian food"
  ]
}

or

["I like to fly", "I hate waking up early", "I enjoy eating Italian food"]

2. Output

Sentiment of given sentence(s): Returns confidence values for positive and negative sentiment. (key = "positive" and key = "negative")

Example of Output:

[
  {
    "positive": 0,
    "negative": 0.333,
    "sentence": "I had an horrible experience at this burger place",
    "neutral": 0.667,
    "compound": -0.5423
  }
]

3. Examples

Example 1:

  • Parameter 1: A string sentence.
{
  "sentence": "I really like double fudge ice cream"
}

Output:

[
  {
    "positive": 0.358,
    "negative": 0,
    "sentence": "I really like double fudge ice cream",
    "neutral": 0.642,
    "compound": 0.4201
  }
]

Example 2:

  • Parameter 1: A list of strings.
{
  "sentenceList": [
    "I like double cheese pizza",
    "I love black coffee and donuts",
    "I don't want to have diabetes"
  ]
}

Output:

[
  {
    "positive": 0.455,
    "negative": 0,
    "sentence": "I like double cheese pizza",
    "neutral": 0.545,
    "compound": 0.3612
  },
  {
    "positive": 0.512,
    "negative": 0,
    "sentence": "I love black coffee and donuts",
    "neutral": 0.488,
    "compound": 0.6369
  },
  {
    "positive": 0,
    "negative": 0.234,
    "sentence": "I don't want to have diabetes",
    "neutral": 0.766,
    "compound": -0.0572
  }
]

4. Credits

For more information, please refer to http://www.socialai.gatech.edu/ or Hutto, C.J. & Gilbert, E.E. (2014). VADER: A Parsimonious Rule-based Model for Sentiment Analysis of Social Media Text. Eighth International Conference on Weblogs and Social Media (ICWSM-14). Ann Arbor, MI, June 2014.