Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use NLTK to determine if a comment is a positive one or a negative one?

Tags:

nlp

nltk

Can you show me a simple example using http://www.nltk.org/code to determine if a string about a happy or upset mood?

like image 817
Juanjo Conti Avatar asked Aug 11 '10 22:08

Juanjo Conti


People also ask

What is the NLTK for text analysis?

In this tutorial, you’ll learn the amazing capabilities of the Natural Language Toolkit (NLTK) for processing and analyzing text, from basic functions to sentiment analysis powered by machine learning! Sentiment analysis can help you determine the ratio of positive to negative engagements about a specific topic.

How to improve the accuracy of sentiment analysis with NLTK?

This was an overview of sentiment analysis with NLTK. There are opportunities to increase the accuracy of the classification model. One example would be to use part-of-speech tagging to train the model using descriptive adjectives or nouns.

How to distinguish between positive and negative sentiments on Twitter?

You can see that the top two discriminating items in the text are the emoticons. Further, words such as sad lead to negative sentiments, whereas welcome and glad are associated with positive sentiments. Next, you can check how the model performs on random tweets from Twitter. Add this code to the file:

What is the difference between NLP and NLTK in text mining?

NLP helps identified sentiment, finding entities in the sentence, and category of blog/article. Text mining is preprocessed data for text analytics. In Text Analytics, statistical and machine learning algorithm used to classify information. NLTK is a powerful Python package that provides a set of diverse natural languages algorithms.


2 Answers

NLTK cannot out of the box, but if you are looking for some related research on that area, take a look at this paper on Offensive Language Detection. The same methods could be adapted to detect comments which are not offensive/unoffensive, but instead happy/unhappy. The primary software package being used in this project for text classification is called WEKA and uses multiple classifiers, trained on previous examples, to determine whether language is offensive or not (and in this method uses a tunable threshold).

like image 120
Chris Avatar answered Oct 18 '22 21:10

Chris


Pattern is something worthwhile a test drive too: you can see two opinion mining experiments right on the project homepage.

http://www.clips.ua.ac.be/pages/pattern-examples-100days

http://www.clips.ua.ac.be/pages/pattern-examples-elections

like image 32
Savino Sguera Avatar answered Oct 18 '22 21:10

Savino Sguera