Open asyrofist opened 3 years ago
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)
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
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
but there is problem that result this one.
JSONDecodeError: Expecting value: line 1 column 1 (char 0)