# roysarvesh/sms-spam-detection-system-using-nlp architecture

> Architecture diagram of the GitHub repository roysarvesh/sms-spam-detection-system-using-nlp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/roysarvesh/sms-spam-detection-system-using-nlp
- Repository: https://github.com/roysarvesh/sms-spam-detection-system-using-nlp

## Overview

##### Main Components

a) Data Processing Layer:
- Input data source (sms-spam.csv)
- Text preprocessing components
- Vectorization process (vectorizer.pkl)

b) Model Layer:
- Machine learning model component (model.pkl)
- Prediction pipeline

c) Application Layer:
- Web interface/API (app.py)
- Request/Response handling

**[Data Layer] → [Processing Layer] → [Service Layer]**

##### Detailed Component Breakdown

a) Data Layer:

b) Processing Layer:
- A component for "Vectorization" (vectorizer.pkl)
- "ML Model" component (model.pkl)

c) Service Layer:
- Flask application (app.py)
- API endpoints
- User interface/client interaction point

##### Flow Representation

- Data flow from CSV to preprocessing
- Text transformation through vectorizer
- Model prediction flow
- API request/response cycle

##### Additional Elements

- Python environment
- Flask framework
- NLP processing steps
- Model type (if known from model.pkl)

##### Important Notes

- Keep the ML pipeline flow clear and distinct
- Both training and inference paths
- Where serialized components (pkl files) are used
- Entry and exit points clearly

##### Technical Stack Callouts

Technologies:
- Python
- Flask
- Scikit-learn (implied by model.pkl)
- NLTK or similar NLP libraries
- Pickle serialization

##### Deployment View

How the system is served:
- Flask server
- Model loading process
- API endpoints

Remember to maintain a balance between showing the ML pipeline complexity and the simplicity of the service architecture. This will help other engineers understand both the data science and engineering aspects of the system.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Data Layer
        TD["Training Data Storage"]:::data
        NB["Model Training Pipeline"]:::notebook
    end

    subgraph Processing Layer
        TP["Text Preprocessing"]:::process
        TV["Text Vectorization"]:::process
        MLM["Machine Learning Model"]:::model
    end

    subgraph Service Layer
        API["Web Application/API"]:::service
        DEP["Dependencies"]:::config
        UI["User Interface"]:::frontend
    end

    TD --> NB
    NB --> TP
    TP --> TV
    TV --> MLM
    MLM --> API
    DEP --> API
    API --> UI

    %% Data flow for inference
    UI -- "SMS Text" --> API
    API -- "Process Text" --> TP
    TP -- "Vectorize" --> TV
    TV -- "Predict" --> MLM
    MLM -- "Classification" --> API
    API -- "Result" --> UI

    %% Styling
    classDef data fill:#1f77b4,stroke:#333,stroke-width:2px
    classDef process fill:#2ca02c,stroke:#333,stroke-width:2px
    classDef model fill:#ff7f0e,stroke:#333,stroke-width:2px
    classDef service fill:#d62728,stroke:#333,stroke-width:2px
    classDef notebook fill:#9467bd,stroke:#333,stroke-width:2px
    classDef config fill:#8c564b,stroke:#333,stroke-width:2px
    classDef frontend fill:#e377c2,stroke:#333,stroke-width:2px

    %% Click events
    click TD "https://github.com/roysarvesh/SMS-Spam-Detection-System-Using-NLP/blob/main/sms-spam.csv"
    click TV "https://github.com/roysarvesh/SMS-Spam-Detection-System-Using-NLP/blob/main/vectorizer.pkl"
    click MLM "https://github.com/roysarvesh/SMS-Spam-Detection-System-Using-NLP/blob/main/model.pkl"
    click API "https://github.com/roysarvesh/SMS-Spam-Detection-System-Using-NLP/blob/main/app.py"
    click NB "https://github.com/roysarvesh/SMS-Spam-Detection-System-Using-NLP/blob/main/sms-spam.ipynb"
    click DEP "https://github.com/roysarvesh/SMS-Spam-Detection-System-Using-NLP/blob/main/requirements.txt"

    %% Legend
    subgraph Legend
        L1["Data Storage"]:::data
        L2["Processing"]:::process
        L3["Model"]:::model
        L4["Service"]:::service
        L5["Notebook"]:::notebook
        L6["Config"]:::config
        L7["Frontend"]:::frontend
    end
```
