1. Introduction
The coronavirus disease 2019 (COVID-19) is an infectious disease caused by severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2) [
1,
2,
3], which became a global pandemic in 2020 [
4] with major disruption to social and economic activities worldwide. The influence of social media on pandemic-related public attitudes and behavioural developments is profound [
5]. During the ongoing COVID-19 pandemic, social media platforms such as Twitter (X) and Facebook have been heavily used for timely information sharing and communication [
6,
7]. Such user-generated contents contribute to a spectrum of opinions ranging from official announcements to the expression of individual beliefs, from credible health updates to the dissemination of rumours and misinformation [
8,
9,
10,
11]. This has facilitated diverse public sentiments towards COVID-19 and its control strategies given a wide range of topics such as racism, deaths, and economic losses [
12]. Some regional studies identified overall positive sentiments initially [
13], despite the polarity of sentiments demonstrated on certain pandemic-related topics such as quarantine measures [
14], mask-wearing [
15], and anti-vaccination [
16,
17].
In the history of viral infections, anti-vaccine activities have been well known and reported during outbreaks and vaccination programmes [
18,
19,
20,
21], such as the refusal of parents to vaccinate children in the USA [
22] and during an outbreak of measles in 2019 in the USA [
23]. In a related study, Figueiredo et al. [
24] mapped global trends in vaccine confidence across 149 countries between 2015 and 2019 and estimated that confidence in vaccines fell in several Asian countries and improved in some of the European Union member states. The study found a link between religious beliefs and vaccine updates and reported a link between religious beliefs and vaccine uptake. Social media has served as a tool for the dissemination of official information and connectivity during lockdowns [
6,
7]; however, it has been a tool for anti-vaccine activities and movements also known as “anti-vaxxers” [
25]. Fear and uncertainty due to abrupt changes in lockdowns during COVID-19 had a huge effect on mental health, which includes patients [
26] and the general population [
27,
28,
29] along with children [
30]; it was highlighted that mental health disorders can increase the risk of infections and barriers in accessing timely health services. Anti-vaxxer movements are also based on notions that are built from conspiracy theories and pseudo-scientific viewpoints [
21]; however, at times, they come from the adverse nature of the official vaccine itself, such as the March 2020 AstraZeneca vaccine ban in 18 countries.
Recent progress in deep learning models has improved language models [
31]. Recurrent neural networks (RNNs) have been prominent for language translation [
32,
33] and sentiment analysis tasks [
34,
35]. The long-short term memory (LSTM) network [
36] is a prominent RNN that has been a backbone of several prominent language models [
31]. There has been some progress in improving LSTM models further with attention mechanism [
37] and Transformer models [
38] that combine attention and other novel innovations in LSTM models. The Transformer model has been prominent in developing pre-trained language models, such as bidirectional encoder representations from transformers (BERT) [
39] for masked language modelling.
Topic modelling [
40] and sentiment analysis [
41] are key areas of study for natural language processing (NLP) [
42] that have been implemented using deep learning and large language models (LLMs) [
43]. These methods have been used to review social media during COVID-19, and some of the major studies are discussed as follows. Xue et al. [
44] used topic modelling and sentiment analysis for 1.9 million tweets related to COVID-19 during the early stages and categorised them into ten themes. The sentiment analysis showed that fear of the unknown nature of the coronavirus was dominant in the respective themes. Hung et al. [
45] presented a social network analysis of COVID-19 sentiments based on tweets from the United States to determine the social network of dominant topics and types of sentiments with geographic analysis and found five prevalent themes which could clarify public response and help officials. Wang et al. [
46] presented sentiment and trend analysis of social media in China via a Bidirectional Encoder Representation from Transformer (BERT) [
39] language model. Chakraborty et al. [
47] presented sentiment analysis of COVID-19 tweets via deep learning with handles related to COVID-19 and the World Health Organisation and found that the tweets have been unsuccessful in guiding people. Abd-Alrazaq et al. [
12] presented a study to find the key concerns of tweets during the COVID-19 pandemic and identified 12 topics with themes such as “origin of the virus”, “its impact on people”, and “the economy”. Other related work on sentiment analysis during COVID-19 focused on managing diabetes [
48], where a change in sentiment was reported when compared to that pre-COVID-19. Furthermore, region-specific X (Twitter) studies included local community sentiment analysis in New South Wales (Australia) [
49], and nationwide sentiment analysis in Nepal [
50] during the early months, where a majority of positive sentiments were expressed with elements of fear. Furthermore, Barkur et al. [
13] used sentiment analysis to study the effect of nationwide lockdown due to the COVID-19 outbreak in India, using 24,000 tweets to generate a word cloud that depicted the majority of positive responses for early lockdowns. Note that the study focused on only two hashtags (#IndiaLockdown and #IndiafightsCorona) in a short span of time (from 25 March to 28 March 2020); hence, major conclusions could not be drawn. Chandra and Krishna [
51] presented a study that focused on a larger time frame (March to July 2020)in India and reported major changes in sentiments given changes in infection and death rates. A study of European cross-language sentiment analysis in the early COVID-19 pandemic separated the results by country of origin, with 4.6 million geotagged tweets collected during the months of December 2019 through April 2020 [
52]. Ng et al. [
53] examined the prevalence of negative sentiments with tweets over a 16-month period using topic modelling and reported themes that included emotional reactions to policies, safety and effectiveness of COVID-19 vaccines. These studies motivate our study to apply sentiment analysis with LLMs for anti-vaccine-related tweets.
The effect of misinformation is becoming severe, and hence there have been discussions about criminalising misinformation on social media. Mills and Sivela [
54] highlighted that the opposing notion to criminalising anti-vaccine (anti-vax) activities was the right to freedom of expression with a restriction for certain cases, such as inciting lawless activities and violence, where anti-vaccination misinformation was not seen such a case. Johnson et al. [
55] reported an online competition with and against vaccination by studying 100 million individuals, partitioned into highly dynamic and interconnected clusters, across different languages around the globe. The study reported that anti-vaccination clusters were highly entangled with undecided clusters and predicted that anti-vaccination views would dominate in a decade. In the age of artificial intelligence and social media analysis [
44,
45,
46], sentiment analysis could be seen as a way to understand public behaviour towards vaccines, which can lay out a framework for policy development. Social media has been used as a tool for studying pandemics [
56] in the past, which covered viral outbreaks such as measles [
57,
58] and the management of the H1NI viral outbreak [
59]. Nu et al. [
60,
60] presented studies using sentiment analysis and topic modelling for measles and influenza vaccination from tweets from 2017 to 2022. However, there have not been studies that reviewed public sentiments concerning how they have expressed their views regarding COVID-19 vaccinations. Sentiment analysis can provide an indication of how a person is reacting towards the vaccination process, e.g., if a tweet featured the terms “COVID-19” and “vaccination” and a model classified the tweet as “fear” and “pessimistic”, then it would lean towards anti-vaccination. Hence, this way, sentiment detection models can guide an understanding of misinformation regarding vaccination.
In this study, we analyse the sentiments from the beginning of the COVID-19 pandemic and study the behaviour during the planning, development and deployment of vaccines expressed in tweets worldwide using a sentiment analysis framework that employs a refined BERT-based language model. We present sentiment analysis and compare selected countries including Australia, Japan, India, Brazil and Indonesia. Our framework defines a set of sentiments to detect anti-vaccine sentiments and provide longitudinal data analysis. We predict sentiments associated with the term vaccine from tweets worldwide for about two years since the beginning of COVID-19. In this way, we provide an analysis of monthly anti-vaccine sentiments throughout the major waves of the earlier phase of the COVID-19 pandemic, where vaccination was a major focus, i.e., from March 2020 to January 2022. We review the nature of the sentiments expressed in relation to the number of tweets and monthly COVID-19 infections.
We note that the pandemic has ended; it is important to understand the different aspects of the pandemic, such as vaccine sentiments. This will enable us to be better prepared regarding the dissemination of information in future endemic and pandemics. Our contribution is about how fine-tuned BERT-based sentiment analysis models can be used to provide a longitudinal study of vaccination response in social media during the pandemic.
The rest of the paper is organised as follows.
Section 2 presents the proposed methodology with Twitter (X) data extraction details along with framework for sentiment analysis.
Section 3 presents the experiments and results.
Section 4 provides a discussion, and
Section 5 concludes the paper with a discussion of future work.
4. Discussion
Our study about the COVID-19 vaccine sentiment analysis study has provided insights into the dynamic moment of sentiments towards vaccines during a global pandemic. Our results show that the volume and sentiment polarity of tweets is closely related to the phase of the pandemic, i.e., there, the selected countries experienced drastic changes in the polarity score at the beginning of the pandemic, which stabilised in the second half of the pandemic (
Figure 9. Local and global peaks in COVID-19 vaccine-related tweets were identified from May to June 2020 and from March to May 2021, which correlates with the rollout of clinical trials [
82] and major concerns for the safety and efficacy of the AstraZeneca vaccine [
83]. There was massive fear in social media due to blood clots being developed by patients around the world from the AstraZeneca vaccine, which was then suspended by European countries [
84].
Anti-vaccine sentiments have led to vaccine hesitancy, a major global public health threat, especially during COVID-19 [
85,
86]. We find more tweets being identified with negative polarity scores when vaccine development progress has been announced and when transmission has been reasonably contained in the case of Australia (
Figure 12).
Figure 8 shows that all the selected countries had “optimistic”, “joking”, annoyed”, “surprised” and “anxious” as the major sentiments expressed. This trend seems to be present throughout the pandemic, looking at the case of Australia (
Figure 12).
Furthermore, in
Figure 6, we notice that the majority of tweets were assigned with only one or two sentiment labels that are consistent with our prior studies about COVID-19 sentiment analysis for India [
51]. Three or more sentiments are rarely expressed in everyday speech, and given that tweets have an upper limit in the number of words, the predictions by the model make sense. These tables provide useful insights for better understanding the vaccine sentiments and the driving forces behind those sentiments. Further work in psychology can be performed with a post-analysis of tweets and the sentiments expressed. Nevertheless, we note that Twitter (X)’s upper limit for a tweet length of fewer than 280 characters may hinder the ability of the model to discover complex interrelationships among multiple sentiment labels.
We revisit the sample tweets in
Table 5 for Australia and draw attention to the second tweet entry
“I think boosters at 3 months might be better for now with future testing to determine efficacy Much talk about the vaccines requiring a third shot to supply full immunity. This is not unusual amongst vaccines; however, it is being used by anti-vaxxers to undermine the vaccine rollout.” which was labelled as “annoyed” and “anxious” with a polarity score of −0.27. Double negative statements [
81], irony, and sarcasm are examples of language constructs that pose challenges for NLP [
87,
88]. At times, it is difficult to understand the context of the actual tweet, and simply concluding from the sentiment labels and scores can result in misleading interpretations of anti-vaccine sentiments. In
Table 6,
“117 million+ Children risk missing out on measles vaccines, as COVID-19 surges: MeaslesRubella” is labelled as “official” and “anxious” with a negative polarity. The wording of official tweets needs to take the anti-vaccine viewpoints into account; during the pandemic, official statements were misinterpreted and twisted to suit anti-vaccine narratives. This sends out an important message to disease control bodies that they should increase transparency, exercise caution, and disseminate information promptly to minimise the spread of misinformation about vaccines. This needs to be performed to restore faith in scientific evidence and reduce ungrounded anti-vaccine sentiments on social media. The policy about masks and distancing [
89] was also implemented in an ad hoc manner, which created further misinformation, along with the implementation of vaccination, risks, and efficacy [
90].
There are certain limitations to our framework and study. Firstly, the BERT-based model was trained using the SenWave dataset, which contained 10,000 sentiment labels manually labelled by experts. This is perceived as a subjective activity due to individual differences in how each sentiment is perceived. Secondly, the current study is only concerned with user-generated data retrieved from one social media platform, Twitter (X), where the user demographic is significantly different from those on other social media platforms such as LinkedIn and Facebook [
91]. The complexity and degree of formality of textual inputs can also vary significantly, and with COVID-19, Twitter (X) suspended many accounts along with Facebook to limit anti-vaccine activities [
92].
Our study was designed to compare the trends of major countries in terms of population and access to Twitter (X). Therefore, countries such as China were naturally excluded since Twitter (X) is not accessible, and our focus was towards countries in the Asia-Pacific region. Although tweet geolocation has limitations [
93], several user-defined studies exist that used this strategy to identify Twitter (X) users from different countries, such as [
53,
75]. We hope that more can be done so that Twitter (X) users have the option to share their data for research purposes.
Furthermore, we excluded retweets, which could have also shed further light on the analysis. Retweets are a significant part of how information spreads on social media, and their exclusion creates a gap in the analysis which can be considered in extension of this study in future work. Our multi-label classification model for the sentiments detects one or two sentiments at most, but it does not provide information about the influence of each sentiment in the case of two sentiments. For example, negative sentiments, such as sadness and anger, may diffuse and influence differently. Moreover, the expression of anger and sadness in online news can have varying effects on the believability and credibility of the news source and its content. These issues can be investigated only after creating a better manually annotated sentiment analysis dataset that provides the sentiment and information on how much they overlap and influence each other. This would need expert analysis and labelling, which could be performed in future work.
The period of the dataset can be seen as a limitation, as it only covers the pandemic up to January 2021 and much has changed about the pandemic (which became an endemic afterwards). However, this period covers the major vaccine-related phases that include the planning, development, and deployment of vaccines. Moreover, this period is also of interest to our study since there were major lockdowns and restrictions around the world which eased afterwards. Although it is perceived that one of the strengths of using Twitter (X) as a data source is the ability to collect data in real-time, downloading data from Twitter (X) requires a lot of resources since data for a specific month or year cannot be downloaded all at once. There is a Twitter (X) app known as the Hydrator that assists in downloading data; however, one needs to restart the app every day, as there are daily limits on how much data can be downloaded. It took our group about six months to obtain the data used in this study, and the data have also been published and publicly available [
62]. In future work, our open-source code framework from this study can be extended, given the rapidly evolving nature of public sentiments around COVID-19 and vaccines. A major limitation is the qualitative evaluation of the predictions, which would be time-consuming, similar to creating the sentiment labels in the SenWave dataset. Qualitative evaluation poses a major limitation for language model applications.
Public discourse analysis such as our study can be reviewed from the perspective of communication theory [
94], psychology theory [
95,
96], and public health theory [
96]. These could help extend our study beyond a purely data-driven strategy, which can be performed in future work. For example, the tweet analysis can be further extended from the perspective of psychology theory including behavioural, cognitive, humanistic, psychodynamic, and biological theories. These can be performed by extending this study with topic modelling and sentiment analysis, and different countries can be compared.
We note that Twitter (X) was formally renamed as X, and certain policy changes were made to facilitate freedom of expression, which was one of the key reasons behind the procurement by Elon Musk. Vidra and Kantorowicz [
97] reviewed Twitter (X) policies before and during the COVID-19 crisis and provided topic modelling for a limited period. Kruspe et al. [
93] revised the Twitter (X) policy changes with geolocation that affects the research in the domain. We note that the
Hydrator application software:
https://github.com/DocNow/hydrator (last accessed 8 December 2024) has not been changed with the change in the name of the platform, and hence the dataset used in this study can be expanded further. We note that Twitter (X) has a significant number of bot-generated tweets [
98], and there has been some attempt by Twitter (X) to remove them. There are also machine learning methods [
99] to detect bot-generated tweets, which can be performed to extend this study further in future work. We did not implement this, as it is also important to provide an analysis of bot-generated tweets to see anti-vaccine sentiments, but it would be useful to distinguish them from human tweets. Furthermore, our dataset does not feature retweets, and our analysis was performed on original tweets.