Stanford nlp for python

前端 未结 9 1246
野的像风
野的像风 2020-11-29 17:41

All I want to do is find the sentiment (positive/negative/neutral) of any given string. On researching I came across Stanford NLP. But sadly its in Java. Any ideas on how ca

9条回答
  •  伪装坚强ぢ
    2020-11-29 18:14

    I would suggest using the TextBlob library. A sample implementation goes like this:

    from textblob import TextBlob
    def sentiment(message):
        # create TextBlob object of passed tweet text
        analysis = TextBlob(message)
        # set sentiment
        return (analysis.sentiment.polarity)
    

提交回复
热议问题