This project uses Deep Learning to automatically classify online comments as Toxic or Non-Toxic. The model helps identify harmful comments, enabling automated content moderation and safer online communities.
The project includes:
- Data Exploration and Preprocessing
- Exploratory Data Analysis (EDA)
- Text Cleaning and Tokenization
- Feature Extraction using Tokenizer & Padding
- Deep Learning Model (LSTM)
- Model Evaluation
- Single Comment Prediction
- Bulk Comment Prediction
- Interactive Streamlit Dashboard
- Model Serialization using Pickle
Online communities and social media platforms generate millions of user comments every day. While these platforms encourage communication and engagement, they also face challenges from toxic comments such as harassment, hate speech, abusive language, and offensive content.
The objective of this project is to develop a Deep Learning-based Comment Toxicity Detection model that automatically classifies comments as Toxic or Non-Toxic. The model assists moderators by identifying harmful comments, enabling safer and healthier online communities.
Dataset: train.csv
| Feature | Description |
|---|---|
| comment_text | User comment text |
| toxic | Toxicity label (0 = Non-Toxic, 1 = Toxic) |
- Programming Language: Python
- Data Manipulation: Pandas, NumPy
- Visualization: Matplotlib
- Machine Learning: Scikit-learn
- Deep Learning: TensorFlow, Keras
- Natural Language Processing: NLTK
- Web Framework: Streamlit
- Model Serialization: Pickle
- Load the dataset into a Pandas DataFrame.
- Explore dataset dimensions.
- Check column names and data types.
- Handle missing values.
- Remove duplicate records.
- Clean comment text.
- Convert text to lowercase.
- Class Distribution
- Pie Chart
- Comment Length Distribution
- Remove punctuation
- Remove special characters
- Remove stopwords
- Tokenization
- Sequence Padding
The Deep Learning model consists of:
- Embedding Layer
- LSTM Layer
- Dropout Layer
- Dense Output Layer (Sigmoid)
Evaluate the model using:
- Accuracy
- Loss
- Prediction Results
Using Pickle:
- tokenizer.pkl
- toxicity_model.pkl
Interactive application providing:
- Home Page
- Dashboard
- Data Visualization
- Single Comment Prediction
- Bulk CSV Prediction
- Model Performance
Measures the percentage of correctly classified comments.
Higher accuracy indicates better model performance.
Measures prediction error during model training.
Lower loss indicates better performance.
COMMENT TOXICITY /
β
βββ Report/
β βββ Comment Toxicity Detection Report.pdf
β
βββ Screenshots/
β βββ Home.png
β βββ Dashboard 1.png
β βββ Dashboard 2.png
β βββ Visualization 1.png
β βββ Visualization 2.png
β βββ Visualization 3.png
β βββ Single Prediction.png
β βββ Bulk Prediction.png
β
βββ app.py
βββ comment analysis.ipynb
βββ README.md
βββ requirements.txt
βββ tokenizer.pkl
βββ toxicity_model.keras
βββ .gitignore
The dataset used in this project is not included in the repository due to its large size.
Place the required dataset files (train.csv and test.csv) in the project directory before running the notebook or Streamlit application.
git clone <repository-url>pip install -r requirements.txtjupyter notebookOpen:
comment analysis.ipynb
streamlit run app.py- Social Media Platforms
- Online Forums and Communities
- Content Moderation Services
- Brand Safety & Reputation Management
- E-learning Platforms
- News Websites and Media Outlets
- Multi-Class Toxicity Classification
- Transformer-based Models (BERT/RoBERTa)
- Explainable AI (SHAP/LIME)
- Cloud Deployment
- Multilingual Toxicity Detection
- Real-Time Moderation API







