Example for Stanford NLP Classifier

2019-05-10 06:32发布

问题:

I am trying to learn the Stanford NLP Classifier and would like to work on the problem of document classification. Can anyone suggest a place where I can find a working example? I was also looking at the Open NLP libraries and was able to find many working examples, like

http://tharindu-rusira.blogspot.com/2013/12/opennlp-text-classifier.html

So, as we can see here, it is quite easy to figure out what's going on and create a small working prototype. However, I can't find a simple example for stanford NLP which will show me

  1. How to specify training data for a classifier.
  2. How to train a model.
  3. How to ingest test data and run the model.

Any suggestions?

回答1:

For 1 and 2, have you looked at the examples on the Wiki page http://nlp.stanford.edu/wiki/Software/Classifier ?

For 3, that page also covers testing from the command line. For use in code, the example code in ClassifierDemo.java included in the download should help you get started.