dasmith / stanford-corenlp-python

Python wrapper for Stanford CoreNLP tools v3.4.1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

~400ms latency problems

scottlingran opened this issue · comments

I noticed a parse through the json-rpc takes 400ms longer than using the java interactive shell.

What's the best way to cut this down? Is it a python issue?

Happy to work on this for a pull request.

On further trial/error, it seems this is the line making it slow

https://github.com/dasmith/stanford-corenlp-python/blob/master/corenlp.py#L189-L193

while True:
  try:
    self.corenlp.read_nonblocking (4000, 0.3)
  except pexpect.TIMEOUT:
    break

Commenting it out reduces the the response time to ~130ms

Not sure what the purpose is?