Every system needs continuous improvement. Feedback, positive or negative, plays an important role in that improvement. Humans are fairly instinctive in interpreting the tone of the feedback. But, to teach a machine to understand the same, is highly complex. Various algorithms and tools are available today to automatically identify and categorize opinions of any textual feedback.

The application of sentiment analysis is wide and useful. It gives us a wide overview of opinion regarding various topics. Sentiment analysis provides the ability to quickly understand the impact of any product or system and react accordingly.

In one of my works, I applied sentiment analysis to predict the opinion of students regarding various academic dimensions of an institute. It is published at Springer. I used R for the purpose and was playing around with various packages already existing at CRAN but none of them was working according to my need. So, I conceptualized a tool, which applies text mining techniques to elicit insights from textual data and  published it as an open source package (RSentiment) to CRAN.

The algorithm uses Parts of Speech tagging to tag each word in the sentence. I designed various cases on sequence of occurrence of various parts of speech. I checked if there is any adverb or adjective bearing positive score following any negative quantifier  “not” , “no” and accordingly assigned score to it. The package categorizes sentences into 5 categories like:

Very Negative
Very Positive

There are currently 3 methods in the package:

calculate_score: calculates score of a sentence or a collection of sentences as 

calculate_sentiment: classifies a sentence or a text into a sentiment category.

calculate_total_presence_sentiment: calculates total number of sentences 
in each sentiment category.

I am working on it for further improvements. Any feedback will be highly appreciated. My package might be able to benefit from it. 😉





12 thoughts on “RSentiment

  1. Pingback: RSentiment – Mubashir Qasim

  2. I just tried playing around with the package out of curiosity, I’ve not done much with sentiment analysis before.

    > calculate_sentiment(“The concert wan’t bad at all”)
    text sentiment
    1 The concert wan’t bad at all Negative
    > calculate_sentiment(“The concert was not bad at all”)
    text sentiment
    1 The concert was not bad at all Positive

    Liked by 1 person

  3. Out of interest is there much work being done on the semantic analysis of texts? For example the following two would obviously be difficult to categorize;

    > calculate_sentiment(“I’ve been to much better concerts”)
    text sentiment
    1 I’ve been to much better concerts Positive
    > calculate_sentiment(“The worst thing was that the show finally had to end”)
    text sentiment
    1 The worst thing was that the show finally had to end Negative

    But I imagine it is the type of thing that in a few years could be achieved through deep learning type of models.

    Liked by 1 person

  4. Hi,
    my major project is to do sentiment analysis for Telugu language I want to give you example “vamshi killed venkat” is a negative sentence with no adjective or adverb so I think you should even take verbs into consideration.


    • Yes, you are right. But what if the sentence is “Vamshi killed the demon”. What sense I shall consider then.. positive or negative? Need to think about this.


  5. I am looking forward on utilizing this package. Feedback: negation handling still needs work. See this page for negation words.

    Example code highlighting the problem.

    > calculate_sentiment(c(“This helps”, “This does not help”, “This doesn’t help”,”This never helps”))

    text sentiment
    1 This helps Positive
    2 This does not help Neutral
    3 This doesn’t help Positive
    4 This never helps Positive


  6. Pingback: Distilled News | Data Analytics & R

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s