Detecting Hate Speech and Offensive Language on Twitter using Machine Learning: An N-gram and TFIDF based Approach
Not on the map. Why?
Abstract (arXiv)
Toxic online content has become a major issue in today's world due to an exponential increase in the use of internet by people of different cultures and educational background. Differentiating hate speech and offensive language is a key challenge in automatic detection of toxic text content. In this paper, we propose an approach to automatically classify tweets on Twitter into three classes: hateful, offensive and clean. Using Twitter dataset, we perform experiments considering n-grams as features and passing their term frequency-inverse document frequency (TFIDF) values to multiple machine learning models. We perform comparative analysis of the models considering several values of n in n-grams and TFIDF normalization methods. After tuning the model giving the best results, we achieve 95.6% accuracy upon evaluating it on test data. We also create a module which serves as an intermediate between user and Twitter.
Key facts. Cited by 10 papers in the map (data through 7 Oct 2026). First posted on arXiv 23 Sep 2018.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2021: 4; 2022: 2; 2023: 1; 2024: 1; 2025: 1; 2026: 1.
10 papers.
- 2023A Comparative Study on TF-IDF feature Weighting Method and its Analysis using Unstructured Datasetcited by 10
- 2021Hate Speech Detection in Roman Urducited by 8
- 2021Mitigating Biases in Toxic Language Detection through Invariant Rationalizationcited by 7
- 2021Combating Hostility: Covid-19 Fake News and Hostile Post Detection in Social Mediacited by 6
- 2022Selecting and combining complementary feature representations and classifiers for hate speech detectioncited by 3
- 2021HASOCOne@FIRE-HASOC2020: Using BERT and Multilingual BERT models for Hate Speech Detectioncited by 2
- 2024English offensive text detection using CNN based Bi-GRU modelcited by 1
- 2025Culture Matters in Toxic Language Detection in Persiancited by 1
- 2022An exploratory experiment on Hindi, Bengali hate-speech detection and transfer learning using neural networkscited by 0
- 2026LinGO: A Linguistic Graph Optimization Framework with LLMs for Interpreting Intents of Online Uncivil Discoursecited by 0
- 2026LinGO: A Linguistic Graph Optimization Framework with LLMs for Interpreting Intents of Online Uncivil Discourse4 Feb 2026
- 2025Culture Matters in Toxic Language Detection in Persian3 Jun 2025
- 2024English offensive text detection using CNN based Bi-GRU model24 Sep 2024
- 2023A Comparative Study on TF-IDF feature Weighting Method and its Analysis using Unstructured Dataset8 Aug 2023
- 2022Selecting and combining complementary feature representations and classifiers for hate speech detection18 Jan 2022
- 2022An exploratory experiment on Hindi, Bengali hate-speech detection and transfer learning using neural networks6 Jan 2022
- 2021Hate Speech Detection in Roman Urdu5 Aug 2021
- 2021Mitigating Biases in Toxic Language Detection through Invariant Rationalization14 Jun 2021
- 2021HASOCOne@FIRE-HASOC2020: Using BERT and Multilingual BERT models for Hate Speech Detection22 Jan 2021
- 2021Combating Hostility: Covid-19 Fake News and Hostile Post Detection in Social Media9 Jan 2021