Analyzing Sentiment of Political X Posts Using Transformer Architectures
The world is becoming increasingly digital, and as millions of users are joining social media platforms, their online actions can reveal their political sentiments and how they might vote. Historically, traditional voter polls have been exposed as slow, inaccurate, and too infrequent to track real-time changes in voter sentiment. As social media sites such as X (formerly Twitter) see hundreds of millions of user posts daily, this has presented an opportunity to identify voter stances on political issues, using machine learning models. Stance detection is a problem subset within natural language processing (NLP) that involves algorithmically identifying the stance of text regarding a given topic. With the recent rise in NLP model and architecture research, researchers have trained stance detection models to use sentiment analysis to predict the winners of national-level elections for political positions. However, predictions of state-level and local elections, specifically policy-based elections, have not been explored. In this paper, we train a transformer neural network architecture that analyzes posts from X related to California's 2020 Proposition 15 election, and classifies them based on sentiment. We created and annotated a dataset of all posts related to Prop 15, developing a novel framework to achieve this. To ensure we trained our primary model on only related and opinionated tweets, we trained a relevancy detector model to filter out unrelated and neutral tweets. Ultimately, we achieved an accuracy of 81%. Our model also accurately predicted the result of the Prop 15 election, showing the capabilities of stance detection in political analysis.
Authors
- Amit Kumar Rana (ORCID: https://orcid.org/0000-0001-8196-5346)
- Rudransh Singh
- Harish Loghashankar
Institutions
- Bellarmine University (US)
Publication Details
- Published
- 2025-03-17
- DOI
- https://doi.org/10.1109/ci-nlpsomecompanion65206.2025.10977894
- Citations
- 1
- Primary Topic
- Sentiment Analysis and Opinion Mining
- Type
- article
- Field-Weighted Citation Impact
- 2.48