# jeet8499/quick-comment-analyzer-chromeextension architecture

> Architecture diagram of the GitHub repository jeet8499/quick-comment-analyzer-chromeextension, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jeet8499/quick-comment-analyzer-chromeextension
- Repository: https://github.com/jeet8499/quick-comment-analyzer-chromeextension

## Overview

Quick Comment Analyzer is a Chrome extension backed by a local Flask sentiment service. Its main workflow sends selected text for model inference, converts positive-class confidence into a star rating, and displays the result in the page. A separate model-preparation workflow trains and saves the model used by the service. The runtime files and README support these links; the extension manifest and some setup details were not sampled.

Main entry points: [`server.py`](https://github.com/jeet8499/quick-comment-analyzer-chromeextension/blob/main/server.py) (Analyze API), [`Extension/background.js`](https://github.com/jeet8499/quick-comment-analyzer-chromeextension/blob/main/Extension/background.js) (Context Menu Handler), [`train_model.py`](https://github.com/jeet8499/quick-comment-analyzer-chromeextension/blob/main/train_model.py) (Model Training), [`sentiment_model.pkl`](https://github.com/jeet8499/quick-comment-analyzer-chromeextension/blob/main/sentiment_model.pkl) (Trained Model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_extension["Chrome Extension"]
  node_background["Context Menu Handler<br/>[background.js]"]
  node_page_alert["Page Rating Alert<br/>[background.js]"]
end

subgraph group_backend["Inference Backend"]
  node_api["Analyze API<br/>[server.py]"]
  node_classifier["Sentiment Inference<br/>[server.py]"]
  node_rating["Rating Conversion<br/>[server.py]"]
end

subgraph group_model_prep["Model Preparation"]
  node_model_file["Trained Model"]
  node_training["Model Training<br/>[train_model.py]"]
  node_dataset_view["Dataset Inspection<br/>[view_data.py]"]
end

node_user(("Web User"))
node_dataset[("IMDB Reviews Dataset")]

node_user -->|"selects text"| node_background
node_background -->|"posts review"| node_api
node_api -->|"requests prediction"| node_classifier
node_api -->|"loads model"| node_model_file
node_classifier -->|"returns probability"| node_rating
node_rating -->|"returns rating"| node_api
node_api -->|"returns JSON"| node_background
node_background -->|"injects result"| node_page_alert
node_page_alert -->|"shows rating"| node_user
node_training -->|"loads reviews"| node_dataset
node_training -->|"saves model"| node_model_file
node_dataset_view -->|"loads reviews"| node_dataset

click node_background "https://github.com/jeet8499/quick-comment-analyzer-chromeextension/blob/main/Extension/background.js"
click node_page_alert "https://github.com/jeet8499/quick-comment-analyzer-chromeextension/blob/main/Extension/background.js"
click node_api "https://github.com/jeet8499/quick-comment-analyzer-chromeextension/blob/main/server.py"
click node_classifier "https://github.com/jeet8499/quick-comment-analyzer-chromeextension/blob/main/server.py"
click node_rating "https://github.com/jeet8499/quick-comment-analyzer-chromeextension/blob/main/server.py"
click node_model_file "https://github.com/jeet8499/quick-comment-analyzer-chromeextension/blob/main/sentiment_model.pkl"
click node_training "https://github.com/jeet8499/quick-comment-analyzer-chromeextension/blob/main/train_model.py"
click node_dataset_view "https://github.com/jeet8499/quick-comment-analyzer-chromeextension/blob/main/view_data.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_background,node_page_alert,node_user toneBlue
class node_api,node_classifier,node_rating,node_dataset toneAmber
class node_model_file,node_training,node_dataset_view toneMint
```

## Components

### Chrome Extension

- [Context Menu Handler](https://github.com/jeet8499/quick-comment-analyzer-chromeextension/blob/main/Extension/background.js): `Extension/background.js`
- [Page Rating Alert](https://github.com/jeet8499/quick-comment-analyzer-chromeextension/blob/main/Extension/background.js): `Extension/background.js`

### Inference Backend

- [Analyze API](https://github.com/jeet8499/quick-comment-analyzer-chromeextension/blob/main/server.py): `server.py`
- [Sentiment Inference](https://github.com/jeet8499/quick-comment-analyzer-chromeextension/blob/main/server.py): `server.py`
- [Rating Conversion](https://github.com/jeet8499/quick-comment-analyzer-chromeextension/blob/main/server.py): `server.py`

### Model Preparation

- [Trained Model](https://github.com/jeet8499/quick-comment-analyzer-chromeextension/blob/main/sentiment_model.pkl): `sentiment_model.pkl`
- [Model Training](https://github.com/jeet8499/quick-comment-analyzer-chromeextension/blob/main/train_model.py): `train_model.py`
- [Dataset Inspection](https://github.com/jeet8499/quick-comment-analyzer-chromeextension/blob/main/view_data.py): `view_data.py`

### Other components

- **Web User**
- **IMDB Reviews Dataset**

## Connections

- Web User → Context Menu Handler: selects text
- Context Menu Handler → Analyze API: posts review
- Analyze API → Sentiment Inference: requests prediction
- Analyze API → Trained Model: loads model
- Sentiment Inference → Rating Conversion: returns probability
- Rating Conversion → Analyze API: returns rating
- Analyze API → Context Menu Handler: returns JSON
- Context Menu Handler → Page Rating Alert: injects result
- Page Rating Alert → Web User: shows rating
- Model Training → IMDB Reviews Dataset: loads reviews
- Model Training → Trained Model: saves model
- Dataset Inspection → IMDB Reviews Dataset: loads reviews
