stanford nlp核心出错 [英] Error in stanford nlp core
问题描述
我下载了stanford nlp,当我运行网站。
I downloaded the stanford nlp and when i run the code which is given in their website .
我在这一行收到错误:
StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
错误如下:
Exception in thread "main" java.lang.NoClassDefFoundError: nu/xom/Node
at sample1.main(sample1.java:35)
Caused by: java.lang.ClassNotFoundException: nu.xom.Node
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
我使用eclipse,我应该做一些配置吗?请帮帮我吧!
I use eclipse , should i do some configuration ? Please help me out with it !
推荐答案
我已从您提供的链接下载了stanford-corenlp-2012-01-08.tgz。使用7-zip我没有压缩它,发现另一个名为stanford-corenlp-2012-01-08的压缩文件,并再次使用7-zip解压缩。内容如下所示:
I have downloaded the stanford-corenlp-2012-01-08.tgz from the link you provided. Using 7-zip I have uncompressed it and found another compressed file with name stanford-corenlp-2012-01-08 and again uncompressed it using 7-zip. The content is shown below:
然后我在eclipse中创建了一个新的Java项目,并在该项目中创建了一个新的文件夹lib并放入
Then I created a new Java Project in eclipse and created a new folder lib inside that project and put
- joda-time .jar
- stanford-corenlp-2011-12-27-models.jar
- stanford-corenlp-2012-01-08.jar
- xom.jar
- joda-time.jar
- stanford-corenlp-2011-12-27-models.jar
- stanford-corenlp-2012-01-08.jar
- xom.jar
jars到lib。然后将项目Java Build Path设置为这些jar。
jars to the lib. Then set the project Java Build Path to these jars.
接下来我用main方法创建了一个测试类。
Next I created a test class with main method.
import java.util.Properties;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
public class NLP {
/**
* @param args
*/
public static void main(String[] args) {
Properties props = new Properties();
props.put("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref");
StanfordCoreNLP coreNLP = new StanfordCoreNLP(props);
}
}
最后运行应用程序。输出如下所示:
And lastly run the application. The output is depicted below:
它成功运行。
希望这会对你有帮助。
这篇关于stanford nlp核心出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!