BookmarkSubscribeRSS Feed
DAN15
Calcite | Level 5
Dear all,

This question was posted on that forum over a year ago. I want an answer to the same question. I've the exact case.

Can anyone help me please?

 

  Sentiment analysis of tweets to identify emotions (happy, sad, angry, worried etc.) 
 

Hi,

 

I wanted to know if SAS Sentiment Analysis studio or another SAS tool can help identify emotions such as happy, sad, anger etc.

I have a dataset of tweets which is already classified as positive, negative or neutral, I wanted to go further to try and identify the sentiment. 

 

If possible, How do I go about doing this analysis in SAS sentiment analysis studio or other SAS tools ?

I currently have access to Base SAS, Enterprise Miner, SAS sentiment analysis studio and SAS VA. Do I need some other tool?

Example of a positive tweet which would be classified as happy would be -

 

@VirginAmerica, you're doing a great job adding little luxuries/aesthetics that improve the air travel experience. Thank you. Keep it up!

 

Thanks a lot !

2 REPLIES 2
ChrisHemedinger
Community Manager

I think sentiment analysis is usually a score along a continuum, with one end of the scale registered as negative and the other as positive, and the midrange is simply neutral.  In this model, discrete emotions like "happy" "sad" "angry" are not part of the ruling.

 

This interesting paper from the Midwest SAS Users Group describes how you might achieve something close to what you want by relying on catchphrases.  Emoticons or emojis may also play a role.  See this paper and this blog post.  In the end, this might be a machine learning problem, where you build a model using training data where you already know the conveyed emotion, and you then score your test data based on what the algorithm has learned from those patterns.

 

Update: a few more thoughts based on some internal discussion here at SAS:

 

SAS software that supports NLP (natural language processing)  and sentiment analysis will score text for "general feeling or opinion", not emotion (which is different).  Consider a tweet that features the word ‘position’ to highlight that you are ‘for or against’ something. You can have a positive attitude towards it or a negative attitude. But, the algorithms do not trying to distinguish if you are positive because you are happy, content, joyful or just peaceful, or if you are negative about something because you are sad, angry, or nervous.

 

There are no real dependable cues to a person’s emotional state in text, partially because many people do not understand their own emotions well enough to depict or name them, even if you asked them to. (This is obvious if you've ever been part of a text-message conversation that results in hurt feelings because one or both parties misreads emotions -- part of the human experience now, it seems.)

 

Consider these examples:

  • "My wife is sorry that we don't yet have a Wegmans in the neighborhood." - maybe sad for my wife, but positive for the Wegmans brand
  • "Yay! I haven't stopped celebrating since the Patriots lost last week!" - maybe happy for me, but negative for the Patriots. (... and yes, I know they actually won last week. It's just an example.)
SAS Hackathon registration is open! Build your skills. Make connections. Enjoy creative freedom. Maybe change the world.
ChrisHemedinger
Community Manager

This question also appeared on Quora recently, and Ralph Winters provided a helpful answer.  Excerpt (see full topic for more):

 

Using only base SAS software you are limited in what you can do, but you can apply some simple algorithms to do this.

e.g you can parse the words using some of the built-in Perl functions, eliminate the stop words (‘the’, ‘ a ‘, etc.), performing stemming (‘complain’=’complaining’), etc. and then write the keywords out into a SAS dataset along with the document #.

 

Then you can merge with a standard sentiment dictionary for positive and negative connotations and assign +1 (for positive word) or -1 (negative word) to a running total. Then summarize the assignments by each document and you have a sentiment metric.

SAS Hackathon registration is open! Build your skills. Make connections. Enjoy creative freedom. Maybe change the world.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1399 views
  • 0 likes
  • 2 in conversation