Cyberbullying is one of the most recent evils of social media. With a boom in the usage of social media, the freedom of expression is being exploited. The program presents a multi-group chat application developed using Python sockets and a Tkinter-based graphical user interface (GUI). The application allows users to create and join chat rooms, send text messages, and share files within rooms. Additionally, an AI-based message filtering system is integrated to detect and hide messages containing bullying content using a pre-trained LinearSVC model. The system enhances real-time communication while ensuring a safe chat environment by preventing offensive or harmful conversations.
Introduction
Overview
Instant messaging applications are widely used for social, educational, and professional communication. However, with this increased usage comes the rise of cyberbullying, harassment, and offensive language in public chat environments. Existing moderation methods (e.g., keyword filters, human moderators) are ineffective and slow. This project proposes a real-time, AI-driven chat system that integrates automated cyberbullying detection to ensure safe, respectful communication.
Motivation
The system is designed to combat:
Cyberbullying in group chats, which affects users—especially teens and students.
Ineffective manual moderation, which is limited in scope and accuracy.
The need for real-time filtering using machine learning (ML) to protect users from harmful content instantly.
Expected Impact:
Promote safe and responsible communication.
Prevent psychological harm.
Encourage platform engagement by creating a non-toxic environment.
Related Works
Previous studies have used various ML and deep learning models to detect cyberbullying:
Traditional ML: Logistic Regression, Naive Bayes, SVM, Random Forest.
Deep Learning: CNNs, LSTM, Bi-LSTM, BLSTM with attention mechanisms.
Word Embeddings: GloVe, SSWE, and random embeddings.
Some advanced models (e.g., smSDA, attention-based Bi-LSTM) have shown superior accuracy and semantic understanding.
System Methodology
Data Collection:
Public datasets from Twitter, Reddit, and others with labeled bullying/non-bullying content.
Examples: Toxic Comment Classification Challenge and Cyberbullying Detection Dataset.
Data Preprocessing:
Text Cleaning: Remove URLs, special characters, stop words.
Tokenization and Stemming/Lemmatization.
Vectorization using TF-IDF or word embeddings to convert text into numerical form.
Trained ML models for detecting and filtering inappropriate messages.
Real-Time Message Flow
Non-Bullying Messages:
Displayed normally in the chat window.
Bullying Messages:
Hidden from the recipient.
Sender receives a warning message: "Stop bullying people and behave decently."
Receiver is notified that a message was blocked due to offensive content.
Conclusion
By leveraging machine learning, it effectively blocks bullying content and ensures a safer communication environment. With further improvements in model accuracy and user experience, this application can be a valuable tool for promoting positive online interactions.Thus, we have successfully extracted, cleaned, and visualized the data using various Python libraries.
We also implemented several natural language processing (NLP) techniques such as tokenization, lemmatization, and vectorization (i.e., feature extraction). After reviewing multiple research papers in this field, we analysed different feature extraction techniques. We found that Count Vectorizer and TF-IDF provide better accuracy compared to Word2Vec and Bag of Words. To determine the best feature extraction method between Count Vectorizer and TF-IDF, we conducted a comparative analysis and observed that Count Vectorizer slightly outperforms TF-IDF in terms of accuracy.
Next, we explored various machine learning algorithms and applied several of them to our project.We trained our models using Count Vectorizer as the feature selection method and obtained good accuracy and efficiency. After training, we summarized all the algorithms in a single plot, comparing Accuracy and F1 score.
Upon analysing the results, we found that Linear SVC and Stochastic Gradient Descent (SGD) classifiers performed the best in classifying and predicting bullying messages in Hinglish. These models not only achieved better classification performance but also required less training and prediction time compared to other algorithms.
References
[1] Varun Jain, Vishant Kumar, Dinesh Kumar Vishwakarma and Vivek Pal, “Detection of Cyberbullying on Social-Media Using Machine Learning” IEEE 2021.
[2] Saloni Mahesh Kargutka and Prof. VidyaChitre, “A Study of Cyberbullying Detection Using Machine Learning Techniques” IEEE 2020 .
[3] Vikas S Chavan and Shylaja S S, “Machine Learning Approach for Detection of Cyber-Aggressive Comments by Peers on Social Media Network” IEEE 2015.
[4] NanlirSallau Mullah and Wan MohdNazeem Wan Zainon, ”Advance in Machine Learning Algorithms for Hate Speech Detection in Social Media” IEEE 2021.
[5] TEOH HWAI TENG AND KASTURI DEWI VARATHAN, “Cyberbullying Detection in Social Networks: A Comparison Between Machine Learning and Transfer Learning Approaches” IEEE 2023.