# himavanth51/aspect-based-product-review-analyser architecture

> Architecture diagram of the GitHub repository himavanth51/aspect-based-product-review-analyser, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/himavanth51/aspect-based-product-review-analyser
- Repository: https://github.com/himavanth51/aspect-based-product-review-analyser

## Overview

This repository is an aspect-based review rating system. Its user workflow accepts a review, splits it into sentences, classifies each sentence as product, delivery, or other, predicts a 1–5 rating conditioned on the aspect, and averages product and delivery ratings for display. The Streamlit app delegates inference to the shared analyzer; a separate script performs batch aspect labeling. The README also describes preprocessing and model-training stages, represented by their notebook paths. Model artifacts and notebook internals are not present in the supplied source excerpts, so those links reflect documented workflow only.

Main entry points: [`src/review_analyzer.py`](https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/src/review_analyzer.py) (Review analyzer), [`notebooks/02_Aspect_classifier_Model_training.ipynb`](https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/notebooks/02_Aspect_classifier_Model_training.ipynb) (Aspect model training), [`streamlit_app.py`](https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/streamlit_app.py) (Streamlit UI), [`notebooks/03_Aspect_rating_dataset.ipynb`](https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/notebooks/03_Aspect_rating_dataset.ipynb) (Rating dataset creation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data_prep["Data preparation"]
  node_preprocessing["Review preprocessing"]
  node_rating_dataset["Rating dataset creation"]
  node_prediction_dataset["Prediction dataset preparation"]
end

subgraph group_model_dev["Model development"]
  node_classifier_training["Aspect model training"]
  node_rating_training["Rating model training"]
end

subgraph group_runtime["Review analysis"]
  node_streamlit["Streamlit UI<br/>[streamlit_app.py]"]
  node_analyzer["Review analyzer<br/>[review_analyzer.py]"]
  node_sentence_split["Sentence segmentation<br/>[review_analyzer.py]"]
  node_aspect_model["Aspect classifier<br/>[review_analyzer.py]"]
  node_rating_model["Rating predictor<br/>[review_analyzer.py]"]
  node_aggregation["Aspect aggregation<br/>[review_analyzer.py]"]
  node_result_view["Ratings display<br/>[streamlit_app.py]"]
  node_batch_aspects["Batch aspect labeling<br/>[predict_aspects.py]"]
end

node_reviewer(("Reviewer"))
node_model_assets["Trained models"]

node_reviewer -->|"enters review"| node_streamlit
node_streamlit -->|"calls analysis"| node_analyzer
node_analyzer -->|"segments review"| node_sentence_split
node_analyzer -->|"classifies sentence"| node_aspect_model
node_analyzer -->|"predicts rating"| node_rating_model
node_analyzer -->|"averages ratings"| node_aggregation
node_analyzer -->|"loads models"| node_model_assets
node_streamlit -->|"renders results"| node_result_view
node_preprocessing -->|"prepares sentences"| node_classifier_training
node_classifier_training -.->|"provides aspect labels"| node_rating_dataset
node_rating_dataset -.->|"prepares rating data"| node_prediction_dataset
node_prediction_dataset -.->|"trains predictor"| node_rating_training
node_classifier_training -->|"saves classifier"| node_model_assets
node_rating_training -->|"saves predictor"| node_model_assets

click node_streamlit "https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/streamlit_app.py"
click node_analyzer "https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/src/review_analyzer.py"
click node_sentence_split "https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/src/review_analyzer.py"
click node_aspect_model "https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/src/review_analyzer.py"
click node_rating_model "https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/src/review_analyzer.py"
click node_aggregation "https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/src/review_analyzer.py"
click node_result_view "https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/streamlit_app.py"
click node_batch_aspects "https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/scripts/predict_aspects.py"
click node_preprocessing "https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/notebooks/01_preprocessing.ipynb"
click node_classifier_training "https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/notebooks/02_Aspect_classifier_Model_training.ipynb"
click node_rating_dataset "https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/notebooks/03_Aspect_rating_dataset.ipynb"
click node_prediction_dataset "https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/notebooks/04_Aspect_prediction_dataset.ipynb"
click node_rating_training "https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/notebooks/05_Aspect_prediction_model.ipynb"

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_preprocessing,node_rating_dataset,node_prediction_dataset,node_reviewer toneBlue
class node_classifier_training,node_rating_training toneAmber
class node_streamlit,node_analyzer,node_sentence_split,node_aspect_model,node_rating_model,node_aggregation,node_result_view,node_batch_aspects toneMint
class node_model_assets toneIndigo
```

## Components

### Data preparation

- [Review preprocessing](https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/notebooks/01_preprocessing.ipynb): `notebooks/01_preprocessing.ipynb`
- [Rating dataset creation](https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/notebooks/03_Aspect_rating_dataset.ipynb): `notebooks/03_Aspect_rating_dataset.ipynb`
- [Prediction dataset preparation](https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/notebooks/04_Aspect_prediction_dataset.ipynb): `notebooks/04_Aspect_prediction_dataset.ipynb`

### Model development

- [Aspect model training](https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/notebooks/02_Aspect_classifier_Model_training.ipynb): `notebooks/02_Aspect_classifier_Model_training.ipynb`
- [Rating model training](https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/notebooks/05_Aspect_prediction_model.ipynb): `notebooks/05_Aspect_prediction_model.ipynb`

### Review analysis

- [Streamlit UI](https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/streamlit_app.py): `streamlit_app.py`
- [Review analyzer](https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/src/review_analyzer.py): `src/review_analyzer.py`
- [Sentence segmentation](https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/src/review_analyzer.py): `src/review_analyzer.py`
- [Aspect classifier](https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/src/review_analyzer.py): `src/review_analyzer.py`
- [Rating predictor](https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/src/review_analyzer.py): `src/review_analyzer.py`
- [Aspect aggregation](https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/src/review_analyzer.py): `src/review_analyzer.py`
- [Ratings display](https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/streamlit_app.py): `streamlit_app.py`
- [Batch aspect labeling](https://github.com/himavanth51/aspect-based-product-review-analyser/blob/main/scripts/predict_aspects.py): `scripts/predict_aspects.py`

### Other components

- **Reviewer**
- **Trained models**

## Connections

- Reviewer → Streamlit UI: enters review (evidence: `README.md`)
- Streamlit UI → Review analyzer: calls analysis (evidence: `streamlit_app.py`)
- Review analyzer → Sentence segmentation: segments review (evidence: `src/review_analyzer.py`)
- Review analyzer → Aspect classifier: classifies sentence (evidence: `src/review_analyzer.py`)
- Review analyzer → Rating predictor: predicts rating (evidence: `src/review_analyzer.py`)
- Review analyzer → Aspect aggregation: averages ratings (evidence: `src/review_analyzer.py`)
- Review analyzer → Trained models: loads models (evidence: `src/review_analyzer.py`)
- Streamlit UI → Ratings display: renders results (evidence: `streamlit_app.py`)
- Review preprocessing → Aspect model training: prepares sentences (evidence: `README.md`)
- Aspect model training → Rating dataset creation: provides aspect labels (evidence: `README.md`)
- Rating dataset creation → Prediction dataset preparation: prepares rating data (evidence: `README.md`)
- Prediction dataset preparation → Rating model training: trains predictor (evidence: `README.md`)
- Aspect model training → Trained models: saves classifier (evidence: `README.md`)
- Rating model training → Trained models: saves predictor (evidence: `README.md`)
