Open davidshumway opened 2 years ago
This appears to start the server, but then running preprocess doesn't appear to work.
PORT = 9000
BASE_URL = 'http://localhost'
URL = BASE_URL + ':{}'.format(PORT)
TIMEOUT = 15000
SHUTDOWN_URL = URL + '/shutdown'
TMPDIR_PROP = 'java.io.tmpdir'
TMPDIR = '/tmp/'
SHUTDOWN_KEY_FILE = TMPDIR + 'corenlp.shutdown'
jars = '{0}/stanford-corenlp.jar:{0}/stanford-corenlp-models.jar:{0}/slf4j-api.jar:{0}/slf4j-simple.jar:{0}/ejml.jar'\
.format('/Users/b/kgen/preprocessor')
command = 'java -D' + TMPDIR_PROP + '="' + TMPDIR + '" -mx5g' + \
' -cp "' + jars + '" edu.stanford.nlp.pipeline.StanfordCoreNLPServer' + \
' -port {} -timeout {}'.format(PORT, TIMEOUT)
from subprocess import Popen
from sys import stderr
java_process = Popen(command, stdout=1, shell=True)
Then:
$ ps -aux | grep java
root 394 0.0 0.0 34308 4780 ? S 18:59 0:00 /bin/sh -c java -Djava.io.tmpdir="/tmp/" -mx5g -cp "/Users/b/kgen/preprocessor/stanford-corenlp.jar:/Users/b/kgen/preprocessor/stanford-corenlp-models.jar:/Users/b/kgen/preprocessor/slf4j-api.jar:/Users/b/kgen/preprocessor/slf4j-simple.jar:/Users/b/kgen/preprocessor/ejml.jar" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 15000
root 395 0.0 0.0 77204 13184 ? Sl 18:59 0:00 java -Djava.io.tmpdir=/tmp/ -mx5g -cp /Users/b/kgen/preprocessor/stanford-corenlp.jar:/Users/b/kgen/preprocessor/stanford-corenlp-models.jar:/Users/b/kgen/preprocessor/slf4j-api.jar:/Users/b/kgen/preprocessor/slf4j-simple.jar:/Users/b/kgen/preprocessor/ejml.jar edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 15000
root 396 0.0 0.0 39196 6468 ? S 18:59 0:00 /bin/bash -c ps -aux | grep java
root 398 0.0 0.0 38572 5648 ? S 18:59 0:00 grep java
For example:
$ cd kgen/preprocessor
$ python3 preprocessor.py ../test.txt
Output appears to hang on coreferences step:
Processing text from /Users/b/kgen/test2txt
Resolving coreferences - please wait, as it may take a while ...
@davidshumway did you get it to work? also was planning to see the effectiveness of this approach.
Environment: macOS Monterey 12.1 (21C52)