Skip to content

how to extract data anotator  #103

Open
@asyrofist

Description

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)

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