Dr Farooq Yousaf 
The confusion surrounding the PTI Government in terms of dealing with the Coronavirus (COVID-19) outbreak is also denting the party’s, especially PM Imran Khan’s, perception on social media. The three major stakeholders currently under discussion on the social media in terms of COVID-19 outbreak include the Sindh Government, the PTI Government and, more recently, DG ISPR.
Even though it should not be taken as a major generalizable indicator, a basic sentiment analysis conducted on these three stakeholders suggests that both the Sindh Government, and its CM Murad Ali Shah, and DGISPR, after his latest press talk on the coronavirus outbreak, are leading Pakistani twitter with twitter users expressing “positive sentiments” towards both of them. Even though sentiments towards PM Imran Khan are also predominantly positive, his ratio/percentage of positive to negative is lower than both CM Sindh and DG ISPR.
In the vast field of data science, sentiment analysis is a technique used in text mining and analysis of various emotions associated with the text. More specifically, it can refer to a “text mining technique for analyzing the underlying sentiment of a text message, i.e., a tweet. Twitter sentiment or opinion expressed through it may be positive, negative or neutral”. I have used a variety of text analysis libraries to run and re-run sentiment analyses of various datasets that I imported from twitter using Twitter’s API in Python.
Due to Twitter’s data extraction limitations, one can only extract a certain number of tweets at a given time. Hence, the following sentiment analyses are based on 500-1000 tweets for each of the three stakeholders. This analysis was performed to gauge the general sentiment of Pakistani Twitter in terms of how it was reacting to various major stakeholders in the country. Moreover, this analysis should be treated as a sample to explore wider applications of Machine Learning and Natural Language processing in political narrative and discourse analysis of Pakistan.
The following analyses of tweets do not contain retweeted tweets. The scale for reading the values of sentiment can be found at the bottom of this page*.
(Anyone interested in performing a Sentiment Analysis on their own can read this resource.)
The COVID-19 pandemic has somewhat brought the Pakistan Peoples Party back in the country’s mainstream politics. According to his supporters and critics alike, CM Murad Ali Shah of Sindh Province has led from the front to tackle the outbreak in the province. It is no wonder that over 80% of the tweets from our random sample of tweets expressed positive sentiments towards the Sindh CM.
Twitter Sentiment on DG ISPR
On the other hand, the newly appointed DG ISPR Maj Gen Babar Iftikhar has received positive feedback on his ‘apolitical’ press talk on Pakistan Resolution Day and the coronavirus pandemic. The DG argued that even though the ‘geographical’ borders had been closed as a preventive measure, “the actual border was between the man and the coronavirus, which we (Pakistan) have yet to take control of”. The tweets mentioning #DGISPR as their hashtag had an 80% positive sentiment ratio.
Twitter Sentiment on PM Imran Khan and PTI
Finally, both PM Imran Khan and his PTI Government had the lowest “positive sentiment” ratio out of the three stakeholders under discussion, with 67% positive tweets mentioning either #ImranKhan and #PTIGovernment. Even though the majority of the tweets in the sample had a positive sentiment, the lowest percentage of the three means that PM, due to lack of clarity in his plan for dealing with the outbreak, might have taken a hit on his popularity on twitter. This is especially interesting because PTI’s social media team and campaigns are considered to be the most sophisticated in the country among all political and non-political stakeholders. Hence, this provides a point of concern for the PM.
Even though Pakistani Twitter’s sentiment analysis presents an interesting picture in terms of the apparent popularity, in terms of positive sentiments, of various political and non-political stakeholders, this analysis should be treated as the “final word” on the topic for two reasons. 1) the sample size of analysis is limited and consists of 500-1000 tweets each for each stakeholder, and 2) the analysis excludes tweets in local and national languages, which might present a different picture altogether. However, the analysis should be treated as an example to explore how policymakers and politicians can use Machine Learning, and Natural Language Processing to gauge sentiments of social media users in the country.
-1: Very Negative Sentiment
1: Very Positive Sentiment
 The author holds a PhD in Politics from the University of Newcastle Australia. He has also previously received his Masters in Public Policy from the University of Erfurt in Germany.