Skip to content
Conference

Offensive Language Detection in Social Media Text Using N-Gram Features and Multinomial Naïve Bayes

Sep 2026 · 2026 7th International Conference on Artificial Intelligence and Data Sciences (AiDAS) · pp. 546-551 · 0 citations · 29 references

Abstract

Offensive language on social-media and messaging platforms creates a need for moderation methods that are accurate, fast, and transparent. This study evaluates a count-based n-gram and Multinomial Naïve Bayes pipeline for binary offensive-language detection and demonstrates its integration into a Telegram bot. The experiments used the 13,240-instance training partition of the Offensive Language Identification Dataset, comprising 8,840 non-offensive and 4,400 offensive English tweets. Text cleaning, lowercasing, stop-word removal, lemmatization, and unigram-to-trigram vectorization were applied. The evaluation compared imbalance-handling strategies, 70/30, 80/20, and 90/10 train-test splits, and three n-gram configurations. The 90/10 split achieved 68.28% accuracy. The selected unigram-bigram configuration achieved 72% accuracy, with 0.57 precision, 0.65 recall, and a 0.61 F1-score for the offensive class. These results demonstrate a trade-off between overall accuracy and sensitivity to offensive messages. The Telegram component is presented as a functional proof of concept rather than a production evaluation. The study demonstrates a lightweight and interpretable prototype while acknowledging limitations related to context, dataset scope, and evolving language.

View source

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.