# ayushmittal62/nlp-amazon-kindle-review-analysis architecture

> Architecture diagram of the GitHub repository ayushmittal62/nlp-amazon-kindle-review-analysis, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ayushmittal62/nlp-amazon-kindle-review-analysis
- Repository: https://github.com/ayushmittal62/nlp-amazon-kindle-review-analysis

## Overview

##### Project Type & Purpose
- This is a data‐science pipeline for performing sentiment analysis on Amazon Kindle reviews.
- All code and orchestration live in a single Jupyter notebook (`main.ipynb`), which executes a linear sequence of steps from raw data ingestion through evaluation and visualization.

##### Main Components
a. Data Source
- `all_kindle_review.csv` (raw dataset)
- External download step from Amazon Product Data (UCSD)
b. Data Preprocessing
- Libraries: pandas, numpy, BeautifulSoup, lxml, nltk
- Steps: lowercasing, HTML/URL removal, tokenization, stopword removal, lemmatization
c. Feature Engineering
- Bag of Words (CountVectorizer)
- TF-IDF (TfidfVectorizer)
- Word2Vec (gensim average vectors)
d. Model Training
- Gaussian Naive Bayes (for BOW & TF-IDF)
- Random Forest Classifier (for Word2Vec)
- Libraries: scikit-learn
e. Evaluation & Visualization
- Accuracy scoring & classification reports
- Confusion matrices (matplotlib/seaborn; optional ROC curves, feature importance)
f. Notebook Environment
- Jupyter Notebook as orchestration layer
- Python kernel running all cells in sequence

##### Component Interactions & Data Flow
- Raw CSV → Preprocessing module → Cleaned text dataset
- Cleaned dataset → Feature Engineering module → Feature matrices/vectors
- Features → Model Training module → Trained models
- Trained models + held-out data → Evaluation module → Metrics & reports
- Metrics → Visualization module → Charts & confusion matrices

##### Architectural Patterns & Principles
- Sequential ETL (Extract → Transform → Load) pattern
- Modular logical separation of concerns within one notebook file
- Reproducibility via pinned library versions and documented download steps

##### Technologies & Frameworks to Annotate
- Data handling: pandas, numpy
- Text processing: nltk (punkt, stopwords, wordnet), BeautifulSoup, lxml
- Embeddings: gensim Word2Vec
- Modeling: scikit-learn (GaussianNB, RandomForestClassifier)
- Visualization: matplotlib, seaborn (optional)
- Execution environment: Jupyter Notebook

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Data Source
    DS["Raw Data\n(all_kindle_review.csv)"]:::data
    click DS "https://github.com/ayushmittal62/nlp-amazon-kindle-review-analysis/blob/main/all_kindle_review.csv"

    %% Notebook Orchestrator Container
    subgraph "Jupyter Notebook Orchestrator"
        direction TB
        NB["Notebook Execution\n(main.ipynb)"]:::notebook
        click NB "https://github.com/ayushmittal62/nlp-amazon-kindle-review-analysis/blob/main/main.ipynb"

        Pre["Preprocessing\n(pandas, NLTK, BeautifulSoup)"]:::process
        FE["Feature Engineering\n(CountVectorizer,\nTfidfVectorizer, Word2Vec)"]:::process
        MT["Model Training\n(GaussianNB, RandomForestClassifier)"]:::process
        EV["Evaluation\n(metrics, confusion matrix)"]:::process
        VIS["Visualization\n(matplotlib, seaborn)"]:::report
    end

    %% Documentation
    DOC["Project Documentation\n(README.md)"]:::doc
    click DOC "https://github.com/ayushmittal62/nlp-amazon-kindle-review-analysis/blob/main/README.md"

    %% Data Flow
    DS --> NB
    NB --> Pre
    Pre --> FE
    FE --> MT
    MT --> EV
    EV --> VIS

    %% Extension Point (optional)
    EXT["Extension Points\n(pretrained embeddings,\nnew classifiers)"]:::extension
    NB -->|optional| EXT

    %% Styles
    classDef data fill:#f9f,stroke:#333,stroke-width:1px;
    classDef notebook fill:#ffb,stroke:#333,stroke-width:1px;
    classDef process fill:#bbf,stroke:#333,stroke-width:1px;
    classDef report fill:#bfb,stroke:#333,stroke-width:1px;
    classDef doc fill:#ffd,stroke:#333,stroke-width:1px;
    classDef extension fill:#eee,stroke-dasharray: 5 5,stroke:#666;
```
