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

Parsing Q #9

Open darshanhegde opened 10 years ago

darshanhegde commented 10 years ago

I'm not sure why, but when I pass 'Q' to the coreNLP server, it breaks down.

Here is the code I'm using:

>>> import jsonrpc
>>> server = jsonrpc.ServerProxy(jsonrpc.JsonRpc20(),jsonrpc.TransportTcpIp(addr=("127.0.0.1", 8080)))
>>> server.parse('Q')
u'{"sentences": []}'

Here is the server error:

NLP> 
========================================
Q
Annotation pipeline timing information:
PTBTokenizerAnnotator: 0.0 sec.
WordsToSentencesAnnotator: 0.0 sec.
POSTaggerAnnotator: 0.0 sec.
MorphaAnnotator: 0.0 sec.
NERCombinerAnnotator: 0.1 sec.
ParserAnnotator: 0.5 sec.
DeterministicCorefAnnotator: 0.0 sec.
TOTAL: 0.7 sec. for 11 tokens at 16.5 tokens/sec.
Pipeline setup: 13.4 sec.
Total time for StanfordCoreNLP pipeline: 75.1 sec.

I'm not sure, if this is a feature or a bug.

darshanhegde commented 10 years ago

pexpect considers 'q'/'Q' as termination message. I'm not sure how to fix that !

dasmith commented 9 years ago

Oops! Thanks for pointing this out. We'll have to insert a check to make sure the stream doesn't begin with 'q'.