Closed rasika closed 10 years ago
What happens if you run the java command there by itself on the command line?
I mean:
java -Xmx4g -cp C:\Python27\lib\site-packages\stanford_corenlp_pywrapper-0.1.0-py2.7.egg\stanford_corenlp_pywrapper\lib\piperunner.jar:C:\Python27\lib\site-packages\stanford_corenlp_pywrapper-0.1.0-py2.7.egg\stanford_corenlp_pywrapper\lib\guava-13.0.1.jar:C:\Python27\lib\site-packages\stanford_corenlp_pywrapper-0.1.0-py2.7.egg\stanford_corenlp_pywrapper\lib\jackson-all-1.9.11.jar:C:\Python27\Scripts\stanford-corenlp-full-2014-08-27\stanford-corenlp-3.4.jar:C:\Python27\Scripts\stanford-corenlp-full-2014-08-27\stanford-corenlp-3.4-models.jar corenlp.PipeCommandRunner --server 12340 --mode pos
One issue is, I think the exec
needs to be removed on Windows.
By the way, there will be other issues and incompatibilities on Windows. I don't know how to make the program work on windows and I don't use windows so I can't do it. It will take some work to figure it out.
Hi, thanks for the quick response. once i ran above mentioned, it gives me Error: could not find or load main class corenlp.PipeCommandRunner
. However i managed to run corenlp manually with;
java -cp "*" -Xmx2g edu.stanford.nlp.pipeline.StanfordCoreNLP -annotators tokenize,ssplit,pos,lemma,parse
.
I found the solution. In windows, I was able to run it with java -Xmx4g -cp "C:\Python27\lib\site-packages\stanford_corenlp_pywrapper-0.1.0-py2.7.egg\stanford_corenlp_pywrapper\lib\piperunner.jar;C:\Python27\lib\site-packages\stanford_corenlp_pywrapper-0.1.0-py2.7.egg\stanford_corenlp_pywrapper\lib\guava-13.0.1.jar;C:\Python27\lib\site-packages\stanford_corenlp_pywrapper-0.1.0-py2.7.egg\stanford_corenlp_pywrapper\lib\jackson-all-1.9.11.jar;C:\Python27\Scripts\stanford-corenlp-full-2014-08-27\stanford-corenlp-3.4.1.jar;C:\Python27\Scripts\stanford-corenlp-full-2014-08-27\stanford-corenlp-3.4.1-models.jar;C:\Python27\Scripts\stanford-corenlp-full-2014-08-27\stanford-srparser-2014-08-28-models.jar" corenlp.PipeCommandRunner --server 12340 --mode pos
Please note that I am using ;
as separator instead of :
and all classpath
parameter is quoted with "
.
Great! Do you mean running just the java command, or the whole SockWrap class?
First I did it on the just command prompt. Then I was able to run SockWrap without any error;
exec
from the COMMAND;
COMMAND = """ {JAVA} -Xmx{XMX_AMOUNT} -cp {classpath} corenlp.PipeCommandRunner --server {server_port} {more_config}"""
:
changed to ;
(semicolon).
self.classpath = ';'.join(jars)
I installed stanford-corenlp-full 3.4.1. Ran following code. from stanford_corenlp_pywrapper import sockwrap p=sockwrap.SockWrap("pos", corenlp_libdir="C:\Python27\Scripts\stanford-corenlp-full-2014-08-27")
it gives me; INFO:StanfordSocketWrap:Starting pipe subprocess, and waiting for signal it's ready, with command: exec java -Xmx4g -cp C:\Python27\lib\site-packages\stanford_corenlp_pywrapper-0.1.0-py2.7.egg\stanford_corenlp_pywrapper\lib\piperunner.jar:C:\Python27\lib\site-packages\stanford_corenlp_pywrapper-0.1.0-py2.7.egg\stanford_corenlp_pywrapper\lib\guava-13.0.1.jar:C:\Python27\lib\site-packages\stanford_corenlp_pywrapper-0.1.0-py2.7.egg\stanford_corenlp_pywrapper\lib\jackson-all-1.9.11.jar:C:\Python27\Scripts\stanford-corenlp-full-2014-08-27\stanford-corenlp-3.4.jar:C:\Python27\Scripts\stanford-corenlp-full-2014-08-27\stanford-corenlp-3.4-models.jar corenlp.PipeCommandRunner --server 12340 --mode pos INFO:StanfordSocketWrap:Subprocess seems to be stopped, exit code 1
Traceback (most recent call last): File "<pyshell#2>", line 1, in
p=sockwrap.SockWrap("pos", corenlp_libdir="C:\Python27\Scripts\stanford-corenlp-full-2014-08-27")
File "C:\Python27\lib\site-packages\stanford_corenlp_pywrapper-0.1.0-py2.7.egg\stanford_corenlp_pywrapper\sockwrap.py", line 82, in init
self.start_server()
File "C:\Python27\lib\site-packages\stanford_corenlp_pywrapper-0.1.0-py2.7.egg\stanford_corenlp_pywrapper\sockwrap.py", line 99, in start_server
time.sleep(STARTUP_BUSY_WAIT_INTERVAL_SEC)