Error in stanford nlp core

南楼画角 提交于 2019-11-28 20:57:50

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:

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

jars to the lib. Then set the project Java Build Path to these jars.

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:

It runs successfully.

Hope this will help you.

I had the same problem using stanford-corenlp-full-2014-10-31.

Tapas Bose's answer is very good, but for this current version (and maybe other earlier ones), you also need to include another two .jar files to get rid of the error:

  • ejml-0.23.jar
  • jollyday.jar

The developers updated this information on the website, too:

To process one file using Stanford CoreNLP, use the following sort of command line (adjust the JAR file date extensions to your downloaded release):

java -cp stanford-corenlp-VV.jar:stanford-corenlp-VV-models.jar:xom.jar:joda-time.jar:jollyday.jar:ejml-VV.jar -Xmx2g edu.stanford.nlp.pipeline.StanfordCoreNLP [ -props <YOUR CONFIGURATION FILE> ] -file <YOUR INPUT FILE>

you also need to add xom.jar to build path.

Please include ejml-0.23.jar in your libraries.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!