Sentiment Analysis

This page is intended for developers, klick here if you are an instructor

This sentiment analysis service is implemented with VADER (Valence Aware Dictionary and sEntiment Reasoner), which a lexicon and rule-based sentiment analysis tool. It is specifically attuned to sentiments expressed in social media, but it is also generally applicable to sentiment analysis in other domains. More information about the algorithm, please see this link

To use this web service, you can either POST a JSON with the following format:

{"review":"review text...."}

to http://peerlogic.csc.ncsu.edu/sentiment/analyze_review.

Alternatively, you can also break down the review into sentences by sending a JSON like

{"sentences": ["sentence 1", "sentence 2",...] }

to http://peerlogic.csc.ncsu.edu/sentiment/analyze_sentences.

Both return an overall sentiment of the review, which is called "overall_compound". Additionally, it returns the sentiment of each sentence as well as the individual polarity (negative, neutral, positive). The service response is formatted in JSON format, as the following example shows:

            {
              "overall_compound": -1.0,
              "sentiments": {
                "After a 20 mile ride, both hands had sores because of this.": {
                  "compound": 0.0,
                  "neg": 0.0,
                  "neu": 1.0,
                  "pos": 0.0
                }, {
                ....
                }
            }
            

In addition, you could also send a bulk of reviews with the following format:

            {
              "reviews":[
                {"id":"1","text":"bad"},
                {"id":"2","text":"not bad"},
                {"id":"3","text":"good"}
              ]
            }

to http://peerlogic.csc.ncsu.edu/sentiment/analyze_reviews_bulk.

It returns the sentiments in the following format:

            {
              "sentiments": [
                {
                  "id": "1",
                  "neg": "1.00",
                  "neu": "0.00",
                  "pos": "0.00",
                  "sentiment": "-0.54",
                  "text": "bad"
                },
                {
                  "id": "2",
                  "neg": "0.00",
                  "neu": "0.26",
                  "pos": "0.74",
                  "sentiment": "0.43",
                  "text": "not bad"
                },
                {
                  "id": "3",
                  "neg": "0.00",
                  "neu": "0.00",
                  "pos": "1.00",
                  "sentiment": "0.44",
                  "text": "good"
                }
              ]
            }
            

Enter a review in a JSON format


Result


        

Example of a review in the JSON configuration

    {
       "review": "These gloves are a good fit for my hand and seem to be decent quality. However, they are not comfortable. There are three seams that converge between the index finger and thumb which creates a very annoying point in the glove. On my first ride I thought I had something caught inside my glove, but when I stopped to check it out, it was just the way the glove was constructed. The left glove is more annoying than the right, but it is there is both gloves. After a 20 mile ride, both hands had sores because of this. Unfortunately there is no way to fix or smooth out this problem. The second issue is that the gel padding is slightly out of place (for my hands anyway) so there is no benefit. I'll be returning these and looking for a new pair of gloves."
    }
            

 


Example of sentences in the JSON configuration

    {
       "sentences": ["These gloves are a good fit for my hand and seem to be decent quality.",
            "However, they are not comfortable. There are three seams that converge between the index finger and thumb which creates a very annoying point in the glove.",
            "On my first ride I thought I had something caught inside my glove, but when I stopped to check it out, it was just the way the glove was constructed.",
            "The left glove is more annoying than the right, but it is there is both gloves. After a 20 mile ride, both hands had sores because of this.",
            "Unfortunately there is no way to fix or smooth out this problem.",
            "The second issue is that the gel padding is slightly out of place (for my hands anyway) so there is no benefit.",
            "I'll be returning these and looking for a new pair of gloves."]
    }
            

 


Example of sentences in the JSON configuration

    {
       "reviews": [{ "id": "1", "text": "These gloves are a good fit for my hand and seem to be decent quality. However, they are not comfortable. There are three seams that converge between the index finger and thumb which creates a very annoying point in the glove. On my first ride I thought I had something caught inside my glove, but when I stopped to check it out, it was just the way the glove was constructed."},
                   { "id": "2", "text": "The left glove is more annoying than the right, but it is there is both gloves. After a 20 mile ride, both hands had sores because of this. Unfortunately there is no way to fix or smooth out this problem. The second issue is that the gel padding is slightly out of place (for my hands anyway) so there is no benefit."},
                   { "id": "3", "text": "The color is great. But I'll be returning these since they are too small"}]

    }