Recently I have been playing around with sentiment analysis and thought I would have some fun. I decided to take my wife to lunch today and am hanging out in her law office waiting for her to finish her day so we can drive home together. She has put me in one of her unused conference rooms with my laptop which has allowed me to continue my playing.
If you want to play with sentiment analysis, you can do so with Python using the Natural Language Toolkit (NLTK). Here is a very simple program that is only 2 lines:
import nltk.sentiment.util as s
print(s.demo_vader_instance("Text to analyze here"))
The program uses the Valence Aware Dictionary for sEntiment Reasoning (VADER) created by C.J. Hutto and Eric Gilbert. It is a great little algorithm that is quite accurate.
I started by analyzing the sentence, "I love my wife" and got a score of .6369 (scores run between -1 and 1). This happens to be the same score I got for, "I love to ski." So according to VADER, I love my wife about the same as I love to ski. I showed that to my wife and got a laugh out of her. Next I added a smiley face ":-)" to the sentence and watched the sentiment increase to .7351. More laughter.
I now have a chat log with 2.3 million lines I will run through it and see what happens for each line. I will then only check a select few but time how long it takes. If you have Python and want to have some fun, load up the NLTK and give it a try.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment