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

后端 未结 4 1327
一个人的身影
一个人的身影 2021-02-09 02:18

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

4条回答
  •  执念已碎
    2021-02-09 02:33

    You're looking for a technique that uses a machine learning classifier to determine whether a piece of text is positive or negative. There have been various different attempts at this by a number of research teams (e.g. http://research.yahoo.com/pub/2387 and http://lingcog.iit.edu/doc/appraisal_sentiment_cikm.pdf) we can get about 80% to 90% accuracy at determining whether a product review is positive or negative.

    Due to the brevity of your question, it's not obvious to me whether determining whether a product review is positive or negative is the same task you're trying to accomplish, or merely a related task, but I'd suggest starting simple with bag-of-words classification with a Bayesian classifier (which NLTK should be able to handle), and then improve your techniques from there depending on how the accuracy turns out.

    Unfortunately, I've never used NLTK (nor Python for that matter) so I can't give you a code example of how to use NLTK for this.

提交回复
热议问题