解决java.lang.NoClassDefFoundError: edu/stanford/nlp/semgraph/semgrex/Semgrex

我们在运行coco评估任务时,会用到cocoevalcap这个类库,具体会用到里面的ROUGE_L、CIDEr以及SPICE这些个评价指标;
运行报错了就是SPICE这个类库报错了,报错信息如下:

Exception in thread "main" java.lang.NoClassDefFoundError: edu/stanford/nlp/semgraph/semgrex/SemgrexPattern
        at edu.anu.spice.SpiceParser.<clinit>(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:387)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)

真的难受的,改了一天的错,突然发现我们从网上拉取到的stanford-corenlp-full-2015-12-09这个包,他在解压之后会放在当前项目的spice/lib这个文件夹下面,但是运行的时候一直报错的路径是你的python环境下的site-packages/pycocoeval/spice/lib这个路径;
所以一直报错NoClassDefFoundError是这个路径里面没有把下面这两个jar包导入进去

stanford-corenlp-3.6.0.jar   &&&  stanford-corenlp-3.6.0-models.jar

解决办法
就是把这两个包放一份在你的python环境下的site-packages/pycocoeval/spice/lib这个路径下面,问题完美解决!!!!
成功运行

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值