Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semgrex Class Not Found Exception #42

Open
shaunakjoshi12 opened this issue Feb 3, 2019 · 3 comments
Open

Semgrex Class Not Found Exception #42

shaunakjoshi12 opened this issue Feb 3, 2019 · 3 comments

Comments

@shaunakjoshi12
Copy link

Even after installing Stanford Core NLP 3.9.2 and pasting the core and the models.jar files in lib,further adding all the jars of core-nlp folder into the CLASSPATH the following issue comes

Exception in thread "main" java.lang.NoClassDefFoundError: edu/stanford/nlp/semgraph/semgrex/SemgrexPattern
at edu.anu.spice.SpiceParser.(SpiceParser.java:64)
at edu.anu.spice.SpiceScorer.scoreBatch(SpiceScorer.java:70)
at edu.anu.spice.SpiceScorer.main(SpiceScorer.java:60)
Caused by: java.lang.ClassNotFoundException: edu.stanford.nlp.semgraph.semgrex.SemgrexPattern
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more
Traceback (most recent call last):
File "test_results.py", line 50, in
metrics_dict = nlgeval.compute_metrics(references, hypotheses)
File "/home/shaunak/ProjectSSSP/FULL_S/caption_generator_resnet/nlg_eval_master/nlgeval/init.py", line 299, in compute_metrics
score, scores = scorer.compute_score(refs, hyps)
File "/home/shaunak/ProjectSSSP/FULL_S/caption_generator_resnet/nlg_eval_master/nlgeval/pycocoevalcap/spice/spice.py", line 70, in compute_score
cwd=os.path.dirname(os.path.abspath(file)))
File "/home/shaunak/anaconda2/lib/python2.7/subprocess.py", line 186, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['java', '-jar', '-Xmx8G', 'spice-1.0.jar', '/home/shaunak/ProjectSSSP/FULL_S/caption_generator_resnet/nlg_eval_master/nlgeval/pycocoevalcap/spice/tmp/tmpVBAF4B', '-cache', '/home/shaunak/ProjectSSSP/FULL_S/caption_generator_resnet/nlg_eval_master/nlgeval/pycocoevalcap/spice/cache', '-out', '/home/shaunak/ProjectSSSP/FULL_S/caption_generator_resnet/nlg_eval_master/nlgeval/pycocoevalcap/spice/tmp/tmpp_GQD4', '-subset', '-silent']' returned non-zero exit status 1
python2 -W ignore test_results.py 26.40s user 0.85s system 193% cpu 14.052 total

Tried this with java 8 and java 9

@muneebable
Copy link

Came across the same problem. Other metrics are working fine.

@idobrusin
Copy link

idobrusin commented Mar 13, 2019

Same issue here with Stanford Core NLP version 3.9.2.

The solution is to use Stanford Core NLP 3.6.0 as specified in the get_stanford_models.sh script.
The simplest way to get the correct model is to run ./get_stanford_models.sh as stated in the README.

Alternatively you can run cocoEvalCapDemo.ipynb notebook, which will additionally verify that your installation is working.

Edit: Add solution to issue

@keepcreative
Copy link

keepcreative commented Sep 20, 2023

Pay special attention to the get_stanford_models.sh script, you may ignore running the script but download the stanford-corenlp-full-2015-12-09 (Stanford Core NLP 3.6.0) package and unzip it yourself, but there are some important file movement in that script:for example: mv $SPICELIB/$CORENLP/$JAR.jar $SPICELIB/ mv $SPICELIB/$CORENLP/$JAR-models.jar $SPICELIB/,if you downloaded the zip file yourself cause of the low speed on the remote server like me, you should do the file movements yourself too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants