Twitter Sentiment Analyser Using NLP Techniques

Twitter Sentiment Analyser Using NLP Techniques

Swarup Kumar Shaw (St. Xavier's College, Kolkata, India), Vinayak Jaiswal (St. Xavier's College, Kolkata, India), Sun Ghosh (St. Xavier's College, Kolkata, India), Anal Acharya (St. Xavier's College, Kolkata, India), and Debabrata Datta (St. Xavier's College, Kolkata, India)
Copyright: © 2024 |Pages: 35
DOI: 10.4018/979-8-3693-0728-1.ch010
OnDemand:
(Individual Chapters)
Available
$37.50
No Current Special Offers
TOTAL SAVINGS: $37.50

Abstract

Twitter is a popular platform where users express their opinions on various topics, including social, political, and economic issues. By monitoring the sentiment of tweets related to a particular topic, companies or governments can identify potential problems before they escalate into full-blown crises, allowing them to take appropriate action in a timely manner. The chapter typically involves collecting a large dataset of tweets, cleaning and pre-processing the data, and then using natural language processing (NLP) and machine learning techniques to classify the sentiment of each tweet.
Chapter Preview
Top

Introduction

Sentiment analysis, also known as opinion mining, is a technique used to analyze text data and determine the sentiment or attitude of the writer towards a particular topic or entity (Go et al., 2009). It involves the use of natural language processing (NLP) and machine learning (ML) algorithms to classify text as positive, negative, or neutral. With the enormous amount of data generated every minute on Twitter, sentiment analysis has become an essential tool for businesses and organizations to understand their audience's opinions and emotions about their products or services. For example, if someone writes a review of a restaurant and says, “the food was delicious,” sentiment analysis would classify that as positive sentiment. If someone writes a review that says, “the service was terrible,” sentiment analysis would classify that as negative sentiment. And if someone writes a review that says, “the restaurant was okay,” sentiment analysis would classify that as neutral sentiment.

There are three basic methodologies of Sentiment Analysis:

  • 1.

    Symbolic techniques or Rule-based approach

  • 2.

    Machine learning techniques or Automatic approach

  • 3.

    Hybrid techniques

Rule-based techniques require an outsized database of predefined emotions and sentiments and an efficient knowledge representation for classifying sentiments properly (Neethu & Rajasree, 2013). In rule-based approach, we use a set of human-crafted rules or guidelines to help determine the subjectivity, polarity, or the subject of an opinion. Rule-based systems are very naive since they do not consider how words are combined in a sequence. Although more advanced processing techniques can be used, and new rules added to support new expressions and vocabulary. However, adding new rules may affect the previous results, and eventually the whole system may get very complex. Since rule-based systems often need fine-tuning and maintenance, they also need regular investment.

Machine learning approach in sentiment analysis involves using a training set to train and develop a sentiment classifier model that categorizes or classifies sentiments. It is simpler than rule-based approach since such a large database of predefined emotions or sentiments is not required (Neethu & Rajasree, 2013). Machine learning techniques for sentiment classification are useful because they are able to capture the context accurately by modelling many features efficiently. They are capable of adapting to changing input and can calculate as a part of the process the degree of uncertainty of classification, making them a suitable technique for many applications (Boiy & Moens, 2008). Machine learning techniques or Automatic approaches rely on different machine algorithms to classify opinions. In this technique, a sentiment analysis task is modelled as a classification problem, where a classifier is loaded with a text and returns a category, e.g., positive, negative, or neutral. This approach involves a training and a prediction process. In the training process the model learns to associate a particular input i.e., a text to the corresponding output or tag, based on the test samples used for training. The feature extractor then transfers the text input into a feature vector. Pairs of feature vectors and tags (positive, negative, or neutral) are input into the machine learning algorithm to generate a model. In the prediction process, the feature extractor is used to transform unknown text inputs into feature vectors. These feature vectors are then input into the model, which then generates the predicted tags (positive, negative, or neutral). For classifying the text, various statistical models may be used such as Naïve Bayes (NB), Support Vector Machines (SVM), Linear Regression, and Deep Learning.

Figure 1.

Machine learning approach to sentiment analysis

979-8-3693-0728-1.ch010.f01

Finally, hybrid approaches combine the desirable elements of rule-based and Machine Learning techniques into one system. The main advantage of this approach is that the results are often more accurate.

Complete Chapter List

Search this Book:
Reset