Dec 30, 2019

Step by Step Guide to Sentiment Analysis


1. Importing Library files

First of all, import the important library files, which are used in the entire sentimental analysis. Like NLTK, pandas, NumPy, sklearn, text blob, etc. pandas are used for importing CSV files (used in next step), nltk is used for natural language processing, TextBlob is built on the shoulders of NLTK and Pattern, sklearn is used for feature extraction.

2. Importing Datasets

Before starting, let’s read the file from the dataset in order to perform different tasks on it. In the entire article, we will use the YouTube sentiment dataset from the Kaggle platform. https://www.kaggle.com/datasnaek/youtube#UScomments.csv).Here, comm is dataframe name, pd.read_csv( ) is pandas function which is used in import the entire dataset. UScomments.csv is file name, which is kept in same file path. error_bad_lines=False,(here, false means bad lines will be dropped from the DataFrame). comm.head() is use for display the first five row of data frame.