An Integrated Classical–Transformer Framework Combining Weighted Support Vector Machines and Multi-Phase BERT for Large-Scale Twitter/X Sentiment Analysis
Main Article Content
Abstract
Micro blogging platforms such as Twitter/X generate hundreds of millions of short, informal posts every day, forming a valuable but noisy signal of public opinion that is exploited in brand monitoring, political analytics, public-health surveillance, and financial forecasting. Two broad families of solutions have emerged to convert this raw stream into reliable sentiment labels: computationally lean classical machine-learning pipelines built around engineered lexical features, and heavyweight transformer-based deep networks that learn contextual representations directly from text. This paper brings both families together in a single, directly comparable study. The first track re-engineers a Support Vector Machine pipeline around bigram-aware TF-IDF weighting, chi-square statistical feature pruning, and instance-level class-balancing, producing a Weighted SVM (WSVM) classifier evaluated on the 1.6-million-tweet Sentiment140 corpus. The second track introduces a three-stage deep-learning pipeline built on a fine-tuned bert-base-uncased backbone: a Noise-Adaptive Lexical Filter (NALF) that scores and routes each tweet through a proportionate cleaning routine, an Attention-Weighted Sentiment Pooling (AWSP) module that learns to emphasize opinion-bearing token positions and fuses them with TF-IDF context, and an Adaptive Threshold Classifier (ATC) that calibrates per-class decision boundaries from batch statistics rather than relying on a fixed softmax cut-off. The WSVM track reaches 88.5% accuracy and an 87.6% F1-score against a 320,000-tweet held-out partition, improving on baseline SVM, Naive Bayes, logistic regression, and random-forest classifiers by margins of up to eleven points. The transformer track, evaluated on a class-balanced three-way partition of the same underlying tweet population (relabeled Sentiment160), reaches 93.8% accuracy, a 92.6% macro F1-score, and an AUC-ROC of 0.971, with statistically significant, independently verified contributions from each of the three novel components (p < 0.001, McNamara’s test). Beyond reporting these headline numbers, this extended treatment provides full architectural flowcharts for both pipelines, closed-form derivations and worked numerical examples of every governing equation, computational-complexity analysis, an itemized error analysis over both tracks, and a discussion of threats to validity. Taken together, the two tracks illustrate a practical accuracy-versus-cost frontier: the WSVM pipeline delivers competitive, fully interpretable, CPU-trainable sentiment classification, while the three-phase BERT framework pushes state-of-the-art accuracy at a materially higher computational and latency cost. The paper closes by discussing when each track is the more appropriate deployment choice and by outlining shared directions for future work, including knowledge distillation, multilingual extension, and multimodal fusion