Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pycorenlp sentiment annotation outputs a string instead of json #35

Open
ugolbck opened this issue Mar 26, 2020 · 0 comments
Open

pycorenlp sentiment annotation outputs a string instead of json #35

ugolbck opened this issue Mar 26, 2020 · 0 comments

Comments

@ugolbck
Copy link

ugolbck commented Mar 26, 2020

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant