Skip to content

pycorenlp sentiment annotation outputs a string instead of json #35

@ugolbck

Description

@ugolbck

Hi, I'm trying to POS tag, lemmatize and do sentiment analysis on some text, but whenever I use the sentiment tool something goes wrong and instead of a json output I get a string.
I get a similar error when trying the sentiment in a browser at http://localhost:9000/ where the output seems to be correct but in a red box and without the usual visuals.

I downloaded the latest version of CoreNLP on the official website, I am running the server with java -mx6g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -timeout 10000 without any problem.

The code I am trying is
from pycorenlp import StanfordCoreNLP
nlp_wrapper = StanfordCoreNLP('http://localhost:9000')
doc = "I like this chocolate."
annot_doc = nlp_wrapper.annotate(doc,
properties={
'annotators': 'sentiment',
'outputFormat': 'json',
'timeout': 10000,
})

I run the code above on:
macOS 10.15.3
pycorenlp 0.3.0
python 3.6
java 8

Thank you for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions