0

I am doing Sentiment Analysis of twitter text and want to do it using Maximum Entropy and SVM. I looked up Stanford Classifier but cannot find its implementation in Java. Can anyone guuide from where to start?

Xavier
  • 113
  • 1
  • 8
  • Here are some resources to look over: https://nlp.stanford.edu/wiki/Software/Classifier and https://nlp.stanford.edu/software/classifier.html – StanfordNLPHelp Mar 27 '17 at 05:45
  • I have looked at them but I got confused with the .prop file attributes and the input test data (why label is present in test data). How will the classifier detect for an unlabeled data? Like I mentioned i am doing sentiment analysis, so I will get unlabeled data and the classifier should be able to tell its sentiment. – Xavier Mar 27 '17 at 06:16
  • you should look over this class: https://github.com/stanfordnlp/CoreNLP/blob/master/src/edu/stanford/nlp/classify/demo/ClassifierDemo.java – StanfordNLPHelp Mar 27 '17 at 07:04
  • particularly these lines show how to get the prediction of the classifier in Java code: Datum d = cdc.makeDatumFromLine(line); System.out.printf("%s ==> %s (%.4f)%n", line, cdc.classOf(d), cdc.scoresOf(d).getCount(cdc.classOf(d))); – StanfordNLPHelp Mar 27 '17 at 07:04
  • So you can use the command line to run the training process and then use the Java API example to produce predictions for new data. – StanfordNLPHelp Mar 27 '17 at 07:07
  • Can the new data be unlabeled? – Xavier Mar 27 '17 at 07:09
  • Yes cdc.classOf(...) will show which label has the highest score, you don't have to have labels for new data you want to make predictions for. – StanfordNLPHelp Mar 27 '17 at 07:22
  • Okay..now suppose I input a simple training file in the format "[polarity] [sentence]". What would be the prop file for such data and how to run the training process using JAVA API? – Xavier Mar 27 '17 at 07:35
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/139124/discussion-between-rakshit-bhatnagar-and-stanfordnlphelp). – Xavier Mar 27 '17 at 07:37
  • Hi sorry I need to go right now! But if you download the standalone classifier which can be found here: https://nlp.stanford.edu/software/classifier.html... there are example .prop files and training data files...you should look at the files examples/cheese2007.prop and examples/cheeseDisease.train which show an example training data file and prop file...you should be able to adapt those to your sentiment, twitter example...also you might be interested in the sentiment codebase as well: https://nlp.stanford.edu/sentiment/ – StanfordNLPHelp Mar 27 '17 at 07:47
  • Hey, do you know how Stanford handles negation, for example: not bad, not good etc. ? – Xavier Mar 27 '17 at 10:36

0 Answers0