Authors
Jahanzeb Munir, Musarat Karim, Mustafa Hameed, Ghada Atteia, Abeer Aljohani, Muhammad Umer, Yunyoung Nam, Byeong-Gwon Kang
Published in
Journal of visualized experiments : JoVE. Issue 237. Nov 13, 2026. Epub Nov 13, 2026.
Abstract
The rapid proliferation of offensive and hate speech on social media platforms poses a significant threat to individual wellbeing and the integrity of online discourse, highlighting the need for accurate, scalable, and computationally efficient automatic detection systems. This study proposes a supervised framework for hate speech detection that integrates transformer-based sentence embeddings with classical machine learning classifiers to balance performance and computational efficiency. Experiments are conducted on the Hate Speech and Offensive Language Dataset, which presents a substantial class imbalance challenge. The proposed approach systematically compares traditional feature representations, including TF-IDF and n-grams, with contextual embeddings derived from Sentence-BERT (SBERT) and DistilBERT. Multiple classifiers, including Logistic Regression (LR), Support Vector Machines (SVM), Random Forests (RF), and Convolutional Neural Networks (CNN) are evaluated. The results show that transformer-based embeddings generally improve F1-score compared with traditional features. Notably, the fusion of SBERT and DistilBERT embeddings with LR achieves superior performance, attaining an accuracy of 94%, precision of 93%, a recall of 92%, and an F1-score of 92%. This indicates improved robustness under imbalanced data conditions. To ensure reliability, the proposed framework is validated using stratified five-fold cross-validation, achieving an average accuracy of 93%. Moreover, in an independent within-dataset replication on a second curated hate speech dataset, the framework achieved 92.56% accuracy. An ablation study further evaluates the contribution of individual components to the framework. The results show that sentence-level transformer embeddings are effective in capturing semantic and contextual nuances that are crucial for identifying abusive language and highlight the potential of lightweight models for real-world deployment.
PMID:
43062156
Bibliographic data and abstract were imported from PubMed on 20 Nov 2026.
Read full publication at:
Please sign in
to see all details.
Advertisement
Stats
- Recommendations n/a n/a positive of 0 vote(s)
- Views 1
- Comments 0