dasmith / stanford-corenlp-python

Python wrapper for Stanford CoreNLP tools v3.4.1
GNU General Public License v2.0
610 stars 229 forks source link

jsonrpc.py randomly fails #53

Open rpanchal1996 opened 7 years ago

rpanchal1996 commented 7 years ago

I am processing large paragraphs using this python interface. If it matters, I have set the encoding to UTF8 because of some characters in the data, and the paragraphs/sentences are fairly large . When I try to execute a script, and make a request to the running core-nlp server, it fails randomly by throwing the error:

jsonrpc.RPCParseError: <RPCFault -32700: 'Parse error.' (u'No valid JSON. (Unterminated string starting at: line 1 column 50 (char 49))')>

And I use the word "randomly" because if and when it fails and I simply try it 3-4 times more, it starts working perfectly. This is a problem if I want to iteratively make calls to the server, as it throws an error in the randomly at any point in the loop and fails.

Does it have anything to do with the fact that

a) The paragraph/sentence size is fairly large(usually 200-400 words). OR b) I am using UTF8 encoding.

Or is it something completely else?

Note: I am using Python 2.7.12 (if that matters)