# sushant2103-afk/hate-speech-and-offensive-language-detection architecture

> Architecture diagram of the GitHub repository sushant2103-afk/hate-speech-and-offensive-language-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sushant2103-afk/hate-speech-and-offensive-language-detection
- Repository: https://github.com/sushant2103-afk/hate-speech-and-offensive-language-detection

## Overview

This repository is a notebook-based workflow for classifying labeled tweets into three classes. The documented path runs from loading and inspecting the dataset through text cleaning, stopword removal and stemming, then vectorization and a train/test split. Decision Tree and Random Forest models are trained and evaluated with classification metrics and a confusion-matrix heatmap. The notebook is the only implementation file in the tree. Relationships and stages below are based on the README; no notebook source excerpts were available to verify finer-grained calls.

Main entry points: [`Project_1_Hate_Speech_Detection.ipynb`](https://github.com/sushant2103-afk/hate-speech-and-offensive-language-detection/blob/main/Project_1_Hate_Speech_Detection.ipynb) (Vectorize and split)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_preparation["Data preparation"]
  node_inspection["Inspect and filter"]
  node_cleaning["Clean tweet text"]
  node_stemming["Remove stopwords and stem"]
  node_features["Vectorize and split"]
end

subgraph group_classification["Classification and evaluation"]
  node_decision_tree["Decision Tree"]
  node_random_forest["Random Forest"]
  node_evaluation["Evaluate predictions"]
  node_visualization["Confusion matrix heatmap"]
end

node_analyst(("Notebook user"))
node_dataset["Labeled tweets"]

node_analyst -->|"runs notebook"| node_inspection
node_dataset -->|"provides tweets"| node_inspection
node_inspection -->|"selects text"| node_cleaning
node_cleaning -->|"passes cleaned text"| node_stemming
node_stemming -->|"passes processed text"| node_features
node_features -->|"provides split features"| node_decision_tree
node_features -->|"provides split features"| node_random_forest
node_decision_tree -->|"provides predictions"| node_evaluation
node_random_forest -->|"provides predictions"| node_evaluation
node_evaluation -->|"renders matrix"| node_visualization

click node_inspection "https://github.com/sushant2103-afk/hate-speech-and-offensive-language-detection/blob/main/Project_1_Hate_Speech_Detection.ipynb"
click node_cleaning "https://github.com/sushant2103-afk/hate-speech-and-offensive-language-detection/blob/main/Project_1_Hate_Speech_Detection.ipynb"
click node_stemming "https://github.com/sushant2103-afk/hate-speech-and-offensive-language-detection/blob/main/Project_1_Hate_Speech_Detection.ipynb"
click node_features "https://github.com/sushant2103-afk/hate-speech-and-offensive-language-detection/blob/main/Project_1_Hate_Speech_Detection.ipynb"
click node_decision_tree "https://github.com/sushant2103-afk/hate-speech-and-offensive-language-detection/blob/main/Project_1_Hate_Speech_Detection.ipynb"
click node_random_forest "https://github.com/sushant2103-afk/hate-speech-and-offensive-language-detection/blob/main/Project_1_Hate_Speech_Detection.ipynb"
click node_evaluation "https://github.com/sushant2103-afk/hate-speech-and-offensive-language-detection/blob/main/Project_1_Hate_Speech_Detection.ipynb"
click node_visualization "https://github.com/sushant2103-afk/hate-speech-and-offensive-language-detection/blob/main/Project_1_Hate_Speech_Detection.ipynb"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_inspection,node_cleaning,node_stemming,node_features,node_analyst toneBlue
class node_decision_tree,node_random_forest,node_evaluation,node_visualization toneAmber
class node_dataset toneIndigo
```

## Components

### Data preparation

- [Inspect and filter](https://github.com/sushant2103-afk/hate-speech-and-offensive-language-detection/blob/main/Project_1_Hate_Speech_Detection.ipynb): `Project_1_Hate_Speech_Detection.ipynb`
- [Clean tweet text](https://github.com/sushant2103-afk/hate-speech-and-offensive-language-detection/blob/main/Project_1_Hate_Speech_Detection.ipynb): `Project_1_Hate_Speech_Detection.ipynb`
- [Remove stopwords and stem](https://github.com/sushant2103-afk/hate-speech-and-offensive-language-detection/blob/main/Project_1_Hate_Speech_Detection.ipynb): `Project_1_Hate_Speech_Detection.ipynb`
- [Vectorize and split](https://github.com/sushant2103-afk/hate-speech-and-offensive-language-detection/blob/main/Project_1_Hate_Speech_Detection.ipynb): `Project_1_Hate_Speech_Detection.ipynb`

### Classification and evaluation

- [Decision Tree](https://github.com/sushant2103-afk/hate-speech-and-offensive-language-detection/blob/main/Project_1_Hate_Speech_Detection.ipynb): `Project_1_Hate_Speech_Detection.ipynb`
- [Random Forest](https://github.com/sushant2103-afk/hate-speech-and-offensive-language-detection/blob/main/Project_1_Hate_Speech_Detection.ipynb): `Project_1_Hate_Speech_Detection.ipynb`
- [Evaluate predictions](https://github.com/sushant2103-afk/hate-speech-and-offensive-language-detection/blob/main/Project_1_Hate_Speech_Detection.ipynb): `Project_1_Hate_Speech_Detection.ipynb`
- [Confusion matrix heatmap](https://github.com/sushant2103-afk/hate-speech-and-offensive-language-detection/blob/main/Project_1_Hate_Speech_Detection.ipynb): `Project_1_Hate_Speech_Detection.ipynb`

### Other components

- **Notebook user**
- **Labeled tweets**

## Connections

- Notebook user → Inspect and filter: runs notebook (evidence: `README.md`)
- Labeled tweets → Inspect and filter: provides tweets (evidence: `README.md`)
- Inspect and filter → Clean tweet text: selects text (evidence: `README.md`)
- Clean tweet text → Remove stopwords and stem: passes cleaned text (evidence: `README.md`)
- Remove stopwords and stem → Vectorize and split: passes processed text (evidence: `README.md`)
- Vectorize and split → Decision Tree: provides split features (evidence: `README.md`)
- Vectorize and split → Random Forest: provides split features (evidence: `README.md`)
- Decision Tree → Evaluate predictions: provides predictions (evidence: `README.md`)
- Random Forest → Evaluate predictions: provides predictions (evidence: `README.md`)
- Evaluate predictions → Confusion matrix heatmap: renders matrix (evidence: `README.md`)
