Closed loretoparisi closed 7 years ago
The necessary jar is at this path: https://github.com/stanfordnlp/CoreNLP/blob/master/lib/ejml-0.23.jar
Also the standard Stanford CoreNLP 3.7.0 distribution folder comes with ejml.
It can be found here: http://stanfordnlp.github.io/CoreNLP/download.html
@J38 Thank. I have added EJML v.23 in the path, but I get a missing class error now:
loaded jar:/Users/loretoparisi/Dropbox (musixmatch)/Development/data/data/stanford/ejml-0.23.jar
loaded jar:/Users/loretoparisi/Dropbox (musixmatch)/Development/data/data/stanford/stanford-arabic-corenlp-2016-10-31-models.jar
loaded jar:/Users/loretoparisi/Dropbox (musixmatch)/Development/data/data/stanford/stanford-chinese-corenlp-2016-10-31-models.jar
loaded jar:/Users/loretoparisi/Dropbox (musixmatch)/Development/data/data/stanford/stanford-corenlp-3.7.0-models.jar
loaded jar:/Users/loretoparisi/Dropbox (musixmatch)/Development/data/data/stanford/stanford-corenlp.jar
loaded jar:/Users/loretoparisi/Dropbox (musixmatch)/Development/data/data/stanford/stanford-english-corenlp-2016-10-31-models.jar
loaded jar:/Users/loretoparisi/Dropbox (musixmatch)/Development/data/data/stanford/stanford-english-kbp-corenlp-2016-10-31-models.jar
loaded jar:/Users/loretoparisi/Dropbox (musixmatch)/Development/data/data/stanford/stanford-french-corenlp-2016-10-31-models.jar
loaded jar:/Users/loretoparisi/Dropbox (musixmatch)/Development/data/data/stanford/stanford-german-corenlp-2016-10-31-models.jar
loaded jar:/Users/loretoparisi/Dropbox (musixmatch)/Development/data/data/stanford/stanford-spanish-corenlp-2016-10-31-models.jar
LANG ENGLISH en
Adding annotator tokenize
Adding annotator ssplit
Adding annotator pos
Loading POS tagger from edu/stanford/nlp/models/pos-tagger/english-left3words/english-left3words-distsim.tagger ... done [0,8 sec].
Adding annotator lemma
Adding annotator ner
Loading classifier from edu/stanford/nlp/models/ner/english.all.3class.distsim.crf.ser.gz ... done [2,2 sec].
Loading classifier from edu/stanford/nlp/models/ner/english.muc.7class.distsim.crf.ser.gz ... done [1,3 sec].
Loading classifier from edu/stanford/nlp/models/ner/english.conll.4class.distsim.crf.ser.gz ... done [0,7 sec].
Adding annotator sentiment
{ Error: Error creating class
java.lang.NoClassDefFoundError: org/ejml/simple/SimpleBase
You can see the loaded jars at the beginning.
@J38 Which CoreNLP jar contains the ejml
library? I'm still having this error:
Caused by: java.io.InvalidClassException: org.ejml.simple.SimpleBase; local class incompatible: stream classdesc serialVersionUID = 7560584869544985034, local class serialVersionUID = -4908174115141247692
I have compiled ejml project (https://github.com/lessthanoptimal/ejml) against JVM 1.8, same version I have built CoreNLP, so I assume it should work. Current version of EJML is 0.30
.
So I have copied all built files
dense64-0.30.jar
core-0.30.jar
equation-0.30.jar
simple-0.30.jar
in my CLASSPATH
.
If I use the 0.23
as you suggest, it does not work as well.
Could you clarify how you are running your Java code and how you are getting Stanford CoreNLP 3.7.0. You don't need to build ejml to run the sentiment annotator with Stanford CoreNLP. The jar we provide should work fine with Stanford CoreNLP 3.7.0.
@J38 I downloaded from the sources, then
cd classes ; jar -cf ../stanford-corenlp.jar edu
export CLASSPATH=/Users/loretoparisi/Documents/CoreNLPDataset/*:/Users/loretoparisi/Documents/Projects/CoreNLP/lib/*:/Users/loretoparisi/Documents/Projects/CoreNLP/liblocal/*
java -mx6g -cp $CLASSPATH edu.stanford.nlp.pipeline.StanfordCoreNLPServer
where I put in the CLASSPATH
the CoreNLP libraries, models, tokenizer and ejml libraries compiled.
I have
$ java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
and the ejml 0.23 that you pointed to me seems not to be compiled against JVM8.
When you set your CLASSPATH you want to have
/Users/loretoparisi/Documents/Projects/CoreNLP/lib/*:/Users/loretoparisi/Documents/Projects/CoreNLP/liblocal/*
and you want to have a directory with these jars:
stanford-corenlp-models-current.jar
stanford-corenlp.jar
And that is all you should have. If you put ejml stuff you compiled in .../Documents/CoreNLPDataset/*
that could definitely cause problems. The ejml jar you want to use is in CoreNLP/lib/*
.
So this CLASSPATH should work fine:
/Users/loretoparisi/Documents/Projects/CoreNLP/lib/*:/Users/loretoparisi/Documents/Projects/CoreNLP/liblocal/*:/path/to/stanford-corenlp-models-current.jar:/path/to/stanford-corenlp.jar
@J38 Thanks a lot, this definitively solves this issue, now it is taking the internal jar, and it works!
[main] INFO CoreNLP - --- StanfordCoreNLPServer#main() called ---
[main] INFO CoreNLP - setting default constituency parser
[main] INFO CoreNLP - using SR parser: edu/stanford/nlp/models/srparser/englishSR.ser.gz
[main] INFO CoreNLP - Threads: 8
[main] INFO CoreNLP - Starting server...
[main] INFO CoreNLP - StanfordCoreNLPServer listening at /0:0:0:0:0:0:0:0:9000
[pool-1-thread-8] ERROR CoreNLP - Failure to load language specific properties.
[pool-1-thread-8] INFO CoreNLP - [/0:0:0:0:0:0:0:1:58441] API call w/annotators tokenize,ssplit,pos,parse,sentiment
I love you my life
[pool-1-thread-8] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator tokenize
[pool-1-thread-8] INFO edu.stanford.nlp.pipeline.TokenizerAnnotator - No tokenizer type provided. Defaulting to PTBTokenizer.
[pool-1-thread-8] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator ssplit
[pool-1-thread-8] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator pos
[pool-1-thread-8] INFO edu.stanford.nlp.tagger.maxent.MaxentTagger - Loading POS tagger from edu/stanford/nlp/models/pos-tagger/english-left3words/english-left3words-distsim.tagger ... done [0,9 sec].
[pool-1-thread-8] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator parse
[pool-1-thread-8] INFO edu.stanford.nlp.parser.common.ParserGrammar - Loading parser from serialized file edu/stanford/nlp/models/srparser/englishSR.ser.gz ... done [14,4 sec].
[pool-1-thread-8] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator sentiment
I have added the
sentiment
annotator among the others:I then get an exception
According to external docs, it seems it's missing the Java math library EJML, so I have downloaded from the sources here and compiled from scratch using
gradle
.I have
I then copied the built jars i.e. the following ones in the
CLASSPATH
:I have compiled against the JVM 8. Now my
CLASSPATH
folder looks likeWhen I try to load the annotators I then get a new error
that seems to be a JVM compiled class file version error (JVM version). The others jars from CoreNLP are ok as I can see from the logs:
I understand that this could be a bit out of the blue, but since those jars of
EJML
are required, which version and against which JVM must be compiled?Thanks.