# tanishqsingh999/email-spam-classifier architecture

> Architecture diagram of the GitHub repository tanishqsingh999/email-spam-classifier, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tanishqsingh999/email-spam-classifier
- Repository: https://github.com/tanishqsingh999/email-spam-classifier

## Overview

Spam Filter AI is a desktop email spam classifier. Its user workflow is to paste email text, submit it for preprocessing and TF-IDF transformation, and see a Naive Bayes spam/not-spam result; the GUI can also clear the text. Separate scripts prepare datasets, extract training features, and train the classifier. The graph includes those documented training stages and saved artifacts. Relationships are based on the shown source and README; no separate evaluation metrics or external email service are shown.

Main entry points: [`src/gui.py`](https://github.com/tanishqsingh999/email-spam-classifier/blob/main/src/gui.py) (Tkinter app), [`src/feature_extraction.py`](https://github.com/tanishqsingh999/email-spam-classifier/blob/main/src/feature_extraction.py) (TF-IDF features), [`src/data_preprocessing.py`](https://github.com/tanishqsingh999/email-spam-classifier/blob/main/src/data_preprocessing.py) (Text preprocessing), [`src/model.py`](https://github.com/tanishqsingh999/email-spam-classifier/blob/main/src/model.py) (Naive Bayes training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Desktop interface"]
  node_gui["Tkinter app<br/>[gui.py]"]
end

subgraph group_text["Text preparation"]
  node_preprocess["Text preprocessing"]
end

subgraph group_training["Model training"]
  node_features["TF-IDF features"]
  node_trainer["Naive Bayes training<br/>[model.py]"]
  node_evaluation["Training split<br/>[evaluation.py]"]
  node_artifacts["Saved model and vectorizer<br/>[gui.py]"]
end

node_user(("Email user"))
node_dataset["Email dataset"]

node_user -->|"pastes email"| node_gui
node_gui -->|"preprocesses text"| node_preprocess
node_preprocess -->|"returns cleaned text"| node_gui
node_gui -->|"loads model files"| node_artifacts
node_gui -->|"transforms and predicts"| node_gui
node_gui -->|"shows classification"| node_user
node_user -->|"clears email"| node_gui
node_dataset -.->|"provides raw data"| node_preprocess
node_preprocess -.->|"prepares training text"| node_features
node_features -->|"saves feature matrix"| node_trainer
node_dataset -->|"provides labels"| node_trainer
node_trainer -->|"saves classifier"| node_artifacts
node_features -->|"saves vectorizer"| node_artifacts
node_dataset -->|"provides labels"| node_evaluation
node_features -->|"loads feature matrix"| node_evaluation
node_evaluation -->|"saves classifier"| node_artifacts

click node_gui "https://github.com/tanishqsingh999/email-spam-classifier/blob/main/src/gui.py"
click node_preprocess "https://github.com/tanishqsingh999/email-spam-classifier/blob/main/src/data_preprocessing.py"
click node_features "https://github.com/tanishqsingh999/email-spam-classifier/blob/main/src/feature_extraction.py"
click node_trainer "https://github.com/tanishqsingh999/email-spam-classifier/blob/main/src/model.py"
click node_evaluation "https://github.com/tanishqsingh999/email-spam-classifier/blob/main/src/evaluation.py"
click node_artifacts "https://github.com/tanishqsingh999/email-spam-classifier/blob/main/src/gui.py"

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_gui,node_user toneBlue
class node_preprocess toneAmber
class node_features,node_trainer,node_evaluation,node_artifacts toneMint
class node_dataset toneIndigo
```

## Components

### Desktop interface

- [Tkinter app](https://github.com/tanishqsingh999/email-spam-classifier/blob/main/src/gui.py): `src/gui.py`

### Text preparation

- [Text preprocessing](https://github.com/tanishqsingh999/email-spam-classifier/blob/main/src/data_preprocessing.py): `src/data_preprocessing.py`

### Model training

- [TF-IDF features](https://github.com/tanishqsingh999/email-spam-classifier/blob/main/src/feature_extraction.py): `src/feature_extraction.py`
- [Naive Bayes training](https://github.com/tanishqsingh999/email-spam-classifier/blob/main/src/model.py): `src/model.py`
- [Training split](https://github.com/tanishqsingh999/email-spam-classifier/blob/main/src/evaluation.py): `src/evaluation.py`
- [Saved model and vectorizer](https://github.com/tanishqsingh999/email-spam-classifier/blob/main/src/gui.py): `src/gui.py`

### Other components

- **Email user**
- **Email dataset**

## Connections

- Email user → Tkinter app: pastes email (evidence: `README.md`)
- Tkinter app → Text preprocessing: preprocesses text (evidence: `src/gui.py`)
- Text preprocessing → Tkinter app: returns cleaned text (evidence: `src/gui.py`)
- Tkinter app → Saved model and vectorizer: loads model files (evidence: `src/gui.py`)
- Tkinter app → Tkinter app: transforms and predicts (evidence: `src/gui.py`)
- Tkinter app → Email user: shows classification (evidence: `src/gui.py`)
- Email user → Tkinter app: clears email (evidence: `src/gui.py`)
- Email dataset → Text preprocessing: provides raw data (evidence: `README.md`)
- Text preprocessing → TF-IDF features: prepares training text (evidence: `README.md`)
- TF-IDF features → Naive Bayes training: saves feature matrix (evidence: `src/model.py`)
- Email dataset → Naive Bayes training: provides labels (evidence: `src/model.py`)
- Naive Bayes training → Saved model and vectorizer: saves classifier (evidence: `src/model.py`)
- TF-IDF features → Saved model and vectorizer: saves vectorizer (evidence: `src/feature_extraction.py`)
- Email dataset → Training split: provides labels (evidence: `src/evaluation.py`)
- TF-IDF features → Training split: loads feature matrix (evidence: `src/evaluation.py`)
- Training split → Saved model and vectorizer: saves classifier (evidence: `src/evaluation.py`)
