3

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?

AbtPst
  • 7,778
  • 17
  • 91
  • 172

1 Answers1

6

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.

Christopher Manning
  • 9,360
  • 34
  • 46
  • Could you please tell me what's the point of "testing" in `ClassifierDemo.java` if `cheeseDisease.test` has category for each line ? If I remove category from text file algorithm erroneously classify everything as category `2`. Thanks! https://github.com/stanfordnlp/CoreNLP/blob/master/src/edu/stanford/nlp/classify/demo/ClassifierDemo.java – expert Jan 27 '16 at 21:40