# m-sriram33/nlp-text-classification-pipeline architecture

> Architecture diagram of the GitHub repository m-sriram33/nlp-text-classification-pipeline, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/m-sriram33/nlp-text-classification-pipeline
- Repository: https://github.com/m-sriram33/nlp-text-classification-pipeline

## Overview

This repository is an IMDb review sentiment-classification project. Its main workflow downloads review data, prepares and analyzes it, trains and evaluates a TF-IDF/Linear SVM model, then serves predictions through a CLI or REST API. The README documents validation, preprocessing, EDA, and model comparison, but their implementations are not present in the supplied tree; those stages are shown as documented capabilities, not verified code connections. The sampled training, evaluation, download, and prediction modules support the other relationships shown.

Main entry points: [`models/sentiment_model.joblib`](https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/models/sentiment_model.joblib) (Serialized pipeline), [`src`](https://github.com/m-sriram33/nlp-text-classification-pipeline/tree/main/src) (Text preprocessing), [`src/train.py`](https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/src/train.py) (SVM training), [`src/predict.py`](https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/src/predict.py) (CLI prediction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Review data"]
  node_imdb[("IMDb dataset")]
  node_download["Dataset download<br/>[download_data.py]"]
  node_validation["Data validation"]
  node_preprocessing["Text preprocessing"]
  node_eda["Exploratory analysis"]
end

subgraph group_ml["Model workflow"]
  node_features["TF-IDF features<br/>[train.py]"]
  node_comparison["Model comparison"]
  node_training["SVM training<br/>[train.py]"]
  node_evaluation["Model evaluation<br/>[evaluate.py]"]
end

subgraph group_serve["Prediction interfaces"]
  node_cli["CLI prediction<br/>[predict.py]"]
  node_api["REST API<br/>[api.py]"]
  node_cliresult["CLI sentiment<br/>[predict.py]"]
  node_apiresult["API sentiment<br/>[api.py]"]
end

subgraph group_artifacts["Model artifacts"]
  node_model["Serialized pipeline"]
end

node_user(("Review user"))

node_imdb -->|"provides reviews"| node_download
node_download -.->|"downloads data"| node_validation
node_validation -.->|"checks then cleans"| node_preprocessing
node_preprocessing -.->|"analyzes cleaned data"| node_eda
node_preprocessing -.->|"prepares training text"| node_features
node_features -->|"extracts features"| node_training
node_training -.->|"compares models"| node_comparison
node_training -->|"serializes pipeline"| node_model
node_model -->|"loads for evaluation"| node_evaluation
node_evaluation -.->|"reports metrics"| node_user
node_user -->|"submits review"| node_cli
node_cli -->|"loads and predicts"| node_model
node_cli -->|"prints sentiment"| node_cliresult
node_user -->|"posts review"| node_api
node_api -->|"loads and predicts"| node_model
node_api -->|"returns sentiment"| node_apiresult

click node_download "https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/src/download_data.py"
click node_validation "https://github.com/m-sriram33/nlp-text-classification-pipeline/tree/main/src"
click node_preprocessing "https://github.com/m-sriram33/nlp-text-classification-pipeline/tree/main/src"
click node_eda "https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/notebooks/01_exploratory_data_analysis.ipynb"
click node_features "https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/src/train.py"
click node_comparison "https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/results/model_comparison.csv"
click node_training "https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/src/train.py"
click node_evaluation "https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/src/evaluate.py"
click node_model "https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/models/sentiment_model.joblib"
click node_cli "https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/src/predict.py"
click node_api "https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/src/api.py"
click node_cliresult "https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/src/predict.py"
click node_apiresult "https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/src/api.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_imdb,node_download,node_validation,node_preprocessing,node_eda,node_user toneBlue
class node_features,node_comparison,node_training,node_evaluation toneAmber
class node_cli,node_api,node_cliresult,node_apiresult toneMint
class node_model toneRose
```

## Components

### Review data

- **IMDb dataset**
- [Dataset download](https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/src/download_data.py): `src/download_data.py`
- [Data validation](https://github.com/m-sriram33/nlp-text-classification-pipeline/tree/main/src): `src`
- [Text preprocessing](https://github.com/m-sriram33/nlp-text-classification-pipeline/tree/main/src): `src`
- [Exploratory analysis](https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/notebooks/01_exploratory_data_analysis.ipynb): `notebooks/01_exploratory_data_analysis.ipynb`

### Model workflow

- [TF-IDF features](https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/src/train.py): `src/train.py`
- [Model comparison](https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/results/model_comparison.csv): `results/model_comparison.csv`
- [SVM training](https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/src/train.py): `src/train.py`
- [Model evaluation](https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/src/evaluate.py): `src/evaluate.py`

### Prediction interfaces

- [CLI prediction](https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/src/predict.py): `src/predict.py`
- [REST API](https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/src/api.py): `src/api.py`
- [CLI sentiment](https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/src/predict.py): `src/predict.py`
- [API sentiment](https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/src/api.py): `src/api.py`

### Model artifacts

- [Serialized pipeline](https://github.com/m-sriram33/nlp-text-classification-pipeline/blob/main/models/sentiment_model.joblib): `models/sentiment_model.joblib`

### Other components

- **Review user**

## Connections

- IMDb dataset → Dataset download: provides reviews (evidence: `src/download_data.py`)
- Dataset download → Data validation: downloads data (evidence: `README.md`)
- Data validation → Text preprocessing: checks then cleans (evidence: `README.md`)
- Text preprocessing → Exploratory analysis: analyzes cleaned data (evidence: `README.md`)
- Text preprocessing → TF-IDF features: prepares training text (evidence: `README.md`)
- TF-IDF features → SVM training: extracts features (evidence: `src/train.py`)
- SVM training → Model comparison: compares models (evidence: `README.md`)
- SVM training → Serialized pipeline: serializes pipeline (evidence: `src/train.py`)
- Serialized pipeline → Model evaluation: loads for evaluation (evidence: `src/evaluate.py`)
- Model evaluation → Review user: reports metrics (evidence: `README.md`)
- Review user → CLI prediction: submits review (evidence: `src/predict.py`)
- CLI prediction → Serialized pipeline: loads and predicts (evidence: `src/predict.py`)
- CLI prediction → CLI sentiment: prints sentiment (evidence: `src/predict.py`)
- Review user → REST API: posts review (evidence: `src/api.py`)
- REST API → Serialized pipeline: loads and predicts (evidence: `src/api.py`)
- REST API → API sentiment: returns sentiment (evidence: `src/api.py`)
