openeventdata / stanford_pipeline

Program to run scraped news stories through CoreNLP.
10 stars 13 forks source link

Loading parser from serialized file edu/stanford/nlp/models/srparser/englishSR.ser.gz ... Exception in thread "main" edu.stanford.nlp.io.RuntimeIOException: java.io.IOException: Unable to resolve "edu/stanford/nlp/models/srparser/englishSR.ser.gz" as either class path, filename or URL #13

Closed dbl001 closed 9 years ago

dbl001 commented 9 years ago

Any ideas on why I can't 'grab' the shift-reduce parser?

OS X 10.10.4. David-Laxers-MacBook-Pro:stanford_pipeline davidlaxer$ python -V Python 2.7.10 :: Anaconda 2.3.0 (x86_64) David-Laxers-MacBook-Pro:stanford_pipeline davidlaxer$ java -version java version "1.8.0_05" Java(TM) SE Runtime Environment (build 1.8.0_05-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

btw - I increased STARTUP_BUSY_WAIT_INTERVAL_SEC to 200.0 in sockwrap.py in stanford_corenlp_pywrapper.

David-Laxers-MacBook-Pro:stanford_pipeline davidlaxer$ python process.py INFO:stanford:Running. INFO:stanford:Returning 601 total stories. INFO:stanford:Setting up CoreNLP.

Setting up StanfordNLP. The program isn't dead. Promise. INFO:StanfordSocketWrap:Starting pipe subprocess, and waiting for signal it's ready, with command: exec java -Xmx4g -cp /users/davidlaxer/anaconda/lib/python2.7/site-packages/stanford_corenlp_pywrapper-0.1.0-py2.7.egg/stanford_corenlp_pywrapper/lib/piperunner.jar:/users/davidlaxer/anaconda/lib/python2.7/site-packages/stanford_corenlp_pywrapper-0.1.0-py2.7.egg/stanford_corenlp_pywrapper/lib/guava-13.0.1.jar:/users/davidlaxer/anaconda/lib/python2.7/site-packages/stanford_corenlp_pywrapper-0.1.0-py2.7.egg/stanford_corenlp_pywrapper/lib/jackson-all-1.9.11.jar:/Users/davidlaxer/stanford-corenlp-full-2015-04-20/stanford-corenlp-3.5.2.jar:/Users/davidlaxer/stanford-corenlp-full-2015-04-20/stanford-corenlp-3.5.2-models.jar:/Users/davidlaxer/stanford-corenlp-full-2015-04-20/stanford-srparser-2014-07-01-models.jar corenlp.PipeCommandRunner --server 12340 --mode justparse --configfile stanford_config.ini [Server] Using mode type: justparse Adding annotator tokenize TokenizerAnnotator: No tokenizer type provided. Defaulting to PTBTokenizer. Adding annotator ssplit Adding annotator pos Reading POS tagger model from edu/stanford/nlp/models/pos-tagger/english-left3words/english-left3words-distsim.tagger ... done [2.6 sec]. Adding annotator parse Loading parser from serialized file edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz ... done [1.9 sec]. [Server] Using CoreNLP configuration file: stanford_config.ini Adding annotator tokenize Adding annotator ssplit Adding annotator pos Adding annotator lemma Adding annotator parse Loading parser from serialized file edu/stanford/nlp/models/srparser/englishSR.ser.gz ... Exception in thread "main" edu.stanford.nlp.io.RuntimeIOException: java.io.IOException: Unable to resolve "edu/stanford/nlp/models/srparser/englishSR.ser.gz" as either class path, filename or URL at edu.stanford.nlp.parser.common.ParserGrammar.loadModel(ParserGrammar.java:183) at edu.stanford.nlp.pipeline.ParserAnnotator.loadModel(ParserAnnotator.java:197) at edu.stanford.nlp.pipeline.ParserAnnotator.(ParserAnnotator.java:107) at edu.stanford.nlp.pipeline.AnnotatorImplementations.parse(AnnotatorImplementations.java:145) at edu.stanford.nlp.pipeline.AnnotatorFactories$11.create(AnnotatorFactories.java:453) at edu.stanford.nlp.pipeline.AnnotatorPool.get(AnnotatorPool.java:85) at edu.stanford.nlp.pipeline.StanfordCoreNLP.construct(StanfordCoreNLP.java:289) at edu.stanford.nlp.pipeline.StanfordCoreNLP.(StanfordCoreNLP.java:126) at edu.stanford.nlp.pipeline.StanfordCoreNLP.(StanfordCoreNLP.java:122) at corenlp.Parse.setConfigurationFromFile(Parse.java:189) at corenlp.PipeCommandRunner.main(PipeCommandRunner.java:83) Caused by: java.io.IOException: Unable to resolve "edu/stanford/nlp/models/srparser/englishSR.ser.gz" as either class path, filename or URL at edu.stanford.nlp.io.IOUtils.getInputStreamFromURLOrClasspathOrFileSystem(IOUtils.java:481) at edu.stanford.nlp.io.IOUtils.readObjectFromURLOrClasspathOrFileSystem(IOUtils.java:313) at edu.stanford.nlp.parser.common.ParserGrammar.loadModel(ParserGrammar.java:180) ... 10 more ^CTraceback (most recent call last): File "process.py", line 138, in run() File "process.py", line 134, in run parser.stanford_parse(coll, stories, stanford_dir) File "/Users/davidlaxer/stanford_pipeline/parser.py", line 33, in stanford_parse corenlp_libdir='/Users/davidlaxer/stanford-corenlp-full-2015-04-20/') File "/users/davidlaxer/anaconda/lib/python2.7/site-packages/stanford_corenlp_pywrapper-0.1.0-py2.7.egg/stanford_corenlp_pywrapper/sockwrap.py", line 82, in init self.start_server() File "/users/davidlaxer/anaconda/lib/python2.7/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)

dbl001 commented 9 years ago

I copied the shift-reduce parser .jar (e.g. -rw-r-----@ 1 davidlaxer staff 619609450 Aug 22 20:20 stanford-srparser-2014-10-23-models.jar) into stanford-corenlp-full-2015-04-20, unzipped the .jar and updated 'sockwrap.py' to:

corenlp_jars=("stanford-corenlp-3.5.2.jar","stanford-corenlp-3.5.2-models.jar","stanford-srparser-2014-10-23-models.jar").

This resolved the error retrieving: edu/stanford/nlp/models/srparser/englishSR.ser.gz