smilli / py-corenlp

Python wrapper for Stanford CoreNLP
353 stars 75 forks source link

All the sentence get a Neutral sentiment #13

Open ghost opened 7 years ago

ghost commented 7 years ago

For instance:

def get_sentiment(x):
    nlp = StanfordCoreNLP('http://localhost:9000')
    res = nlp.annotate(x,
                       properties={
                           'annotators': 'sentiment',
                           'outputFormat': 'json'
                       })
    return s["sentiment"]

and get_sentiment('I am sad.') reutrns Neutral. get_sentiment('I am enjoying it.') also returns Neutral. But when I enter http://localhost:9000 in the browser and submit sentences above, I get Negative and Positive respectively. What's the problem with it? Thanks in advance.