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

how to extract data anotator #103

Open
asyrofist opened this issue Oct 8, 2021 · 0 comments
Open

how to extract data anotator #103

asyrofist opened this issue Oct 8, 2021 · 0 comments

Comments

@asyrofist
Copy link

asyrofist commented Oct 8, 2021

How can I handle error. If there is error like this
I'm using like this syntax

after several trial. I have notice, to load json using this function from this issue

import nltk, json, pycorenlp, stanfordcorenlp
from clause import clauseSentence

url_stanford = 'http://corenlp.run'
model_stanford = "stanford-corenlp-4.0.0"
try:
  nlp = pycorenlp.StanfordCoreNLP(url_stanford) # pycorenlp
except:
  nlp = stanfordcorenlp.StanfordCoreNLP(model_stanford) # stanford nlp

props={"annotators":"parse","outputFormat": "json"}
sent = 'The product shall plot the data points in a scientifically correct manner'
dataform = nlp.annotate(sent, properties=props)
try:
  dt = clauseSentence().print_clauses(dataform['sentences'][0]['parse'])
except:
  parser = json.loads(dataform)
  dt = clauseSentence().print_clauses(parser['sentences'][0]['parse'])
print(dt)

but there is problem that result this one.
JSONDecodeError: Expecting value: line 1 column 1 (char 0)

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