简体   繁体   中英

How to create a Stanford coreNLP model by training?

I'm very new to Stanford's coreNLP and I'm trying to train it by creating a model. I have a folder that has dev.txt, train.txt, and test.txt as well as a jar file named stanford-corenlp-3.5.1-models.jar. According to this question, I can create a model by executing the following command in the terminal:

java -mx8g edu.stanford.nlp.sentiment.SentimentTraining -numHid 25 -trainPath train.txt -devPath     dev.txt -train -model model.ser.gz

However, when I run that in the terminal, I get the following error:

Error: could not find or load main class edu.stanford.nlp.sentiment.SentimentTraining

Can anyone provide step-by-step instructions of how to go about training CoreNLP? I went on the Stanford website to see how training is done, but I'm still confused. I thought all I needed to create a model (eg model.ser.gz) were those three text files and one jar file.

Any help is very appreciated, thank you!

You need to include the CoreNLP jar file in your classpath. So, your java command should look like:

java -cp /path/to/corenlp/jar:/path/to/corenlp/library/dependencies -mx8g ...

From the root of the CoreNLP distribution, you can just include all the jars in the directory; eg,

java -cp "*" -mx8g edu.stanford.nlp.sentiment.SentimentTraining -numHid 25 -trainPath train.txt -devPath dev.txt -train -model model.ser.gz

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM