3
$\begingroup$

I am very new in machine learning. I have annotated data with category, aspect, opinion word and sentiment. for example, for the bellow text

"The apple was really tasty"

I have category->food, aspect-> apple, opinion word ->tasty and sentiment->positive. I have training data like this format.

How can I train a SVM classifier using this format of training set? How to extract features like n-gram, POS and sentiment word to train the classifier? Could you please suggest any beginning step for this aspect based sentiment analysis using machine learning algorithms?

$\endgroup$

2 Answers 2

3
$\begingroup$

Aleksandar Blekh has given some really nice links about the big picture of how to do sentiment analysis; I'll try to provide some links to software and talk about the nitty-gritty of how to make it work. I'll point you to the example using scikit-learn (http://scikit-learn.org/stable/ ), a machine learning library in Python.

You would first want to take your dataset and load it into scikit-learn in a sparse format. This link (http://scikit-learn.org/stable/tutorial/text_analytics/working_with_text_data.html ) gives examples of how to load text in a bag-of-words representation, and the same module (scikit-learn.feature_extraction.text) can also count n-grams. It then describes how to run Naive Bayes and SVM on that dataset. You can take that example and start playing with it.

$\endgroup$
2
  • $\begingroup$ Aleksandr Blekh and @Max Gibiansky, thanks for the starting guidelines. $\endgroup$
    – Khaled
    Jan 15, 2015 at 8:40
  • $\begingroup$ You are welcome, @hossain. Thank you for kind words, Max. $\endgroup$ Jan 16, 2015 at 10:11
1
$\begingroup$

I would recommend you to start from reading the draft of the introductory book "Sentiment analysis and opinion mining" by Bing Liu. The draft in a PDF document format is available for free here.

More details about the new upcoming book of this author, as well as comprehensive information on the topic of aspect-based sentiment analysis, with references and links to data sets, are available at this page: http://www.cs.uic.edu/~liub/FBS/sentiment-analysis.html.

Another interesting resource is a survey book "Opinion mining and sentiment analysis by Bo Pang and Lillian Lee. The book is available in print and as a downloadable PDF e-book in a published version or an author-formatted version, which are almost identical in terms of contents.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.