Publication Details
Issue: Vol 3, No 2 (2026)
ISSN: 2997-3961
Visit Journal Website

Abstract

The need to understand public sentiment, especially in the context The necessity of gauging public opinion, particularly in social media con-texts, has firmly established sentiment analysis as one of the most significant Natural Language Processing (NLP) tasks. In this paper, we present a sentiment classification framework for high performance using the transformer-based Bidirectional Encoder Representations from Transformers (BERT) model, trained on a deliberately curated multi-platform dataset of Twitter, Reddit, and Facebook posts. The multi-source evidential discourses adhered to in this study addressed weaknesses in previous studies including electorate bias of mono- source datasets, class imbalance, and lack of explanation from high-performing and restrictive data sources that approached a balanced multi-class distribution through up sampling. Following BERT’s preprocessing pipeline of lowercasing, URL and mention removals, punctuation removals, and white space sanitization, a maximum sequence length of 128 was used with the BERT model, and treated by the tokenization of bert-base-uncased. The BERT model was pre-trained and supervised on a balanced dataset of 18,356 documents, completing 5 epoch trainings, yielding remarkable classification accuracies of 99% with attained precision of 0.99, recall of 0.99, and F1-score of 0.99. The model was also assessed through visual analyses of confusion matrices, ROC curves, and epoch-wise loss plots which provided insights regarding model robustness and generalizability. Compared to both traditional methods and earlier approaches in deep learning, the pro-posed system achieves unprecedented performance particularly with the short, noisy and informal text that predominates social media.

Keywords
BERT Sentiment Analysis NLP Deep Learning Social Media