In machine learning, sentiment analysis applies natural language processing and computational linguistics to identify the writer's attitude towards a topic or the overall contextual polarity of a document. A key step is finding opinion words (also called polarity or sentiment words), the main indicators of sentiment, which can be positive or negative.
The project uses a dataset of 40,000 IMDB movie reviews with a text column and a label column. It plots the class distribution, strips HTML tags with regular expressions, simplifies the text with NLTK's PorterStemmer, removes stop words and draws word clouds of positive words (love, excellent, perfect, good, beautiful, kind) and negative words (horrible, wasteful, problem, stupid and others). The documents are then turned into a feature matrix with a TF-IDF vectorizer, split 50/50 into training and test sets, and classified with a logistic regression model.
The Arabic article is a translation of an English tutorial. Read the original: Sentiment Analysis with Python (thecleverprogrammer.com).
Post links
- Via: thecleverprogrammer

