# tulsi12/recommendationsystembasedonsentimentanalysis architecture

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

- Interactive diagram: https://gitdiagram.com/tulsi12/recommendationsystembasedonsentimentanalysis
- Repository: https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis

## Overview

This Flask app lets users request product recommendations by username or classify a review as positive or negative. Recommendation requests select candidate products for a known user, score their reviews with a trained sentiment model, and return the top products; review classification preprocesses the submitted text and predicts its sentiment. The graph reflects the sampled Flask and model code. The template and serialized assets are present in the tree, but their internals were not sampled.

Main entry points: [`model.py`](https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/model.py) (Product recommendations), [`app.py`](https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/app.py) (Flask routes), [`pickle/tfidf-vectorizer.pkl`](https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/pickle/tfidf-vectorizer.pkl) (TF-IDF vectorizer), [`pickle/sentiment-classification-xg-boost-model.pkl`](https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/pickle/sentiment-classification-xg-boost-model.pkl) (Sentiment model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_flask["Flask routes<br/>[app.py]"]
  node_template["Web form and results<br/>[index.html]"]
end

subgraph group_recommend["Recommendations"]
  node_rec["Product recommendations<br/>[model.py]"]
end

subgraph group_sentiment["Sentiment analysis"]
  node_sent["Review classification<br/>[model.py]"]
  node_prep["Text preprocessing<br/>[model.py]"]
end

subgraph group_assets["Data and models"]
  node_ratings["User-product ratings"]
  node_clean["Cleaned reviews<br/>[cleaned-data.pkl]"]
  node_products["Product details<br/>[sample30.csv]"]
  node_vectorizer["TF-IDF vectorizer"]
  node_classifier["Sentiment model"]
end

node_user(("User"))

node_user -->|"submits request"| node_flask
node_flask -->|"renders"| node_template
node_flask -->|"requests recommendations"| node_rec
node_flask -->|"classifies review"| node_sent
node_rec -->|"reads ratings"| node_ratings
node_rec -->|"filters reviews"| node_clean
node_rec -->|"transforms reviews"| node_vectorizer
node_rec -->|"predicts review sentiment"| node_classifier
node_rec -->|"joins product details"| node_products
node_sent -->|"preprocesses text"| node_prep
node_sent -->|"transforms text"| node_vectorizer
node_sent -->|"predicts sentiment"| node_classifier
node_prep -->|"lemmatizes tokens"| node_prep

click node_flask "https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/app.py"
click node_template "https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/templates/index.html"
click node_rec "https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/model.py"
click node_sent "https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/model.py"
click node_prep "https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/model.py"
click node_ratings "https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/pickle/user_final_rating.pkl"
click node_clean "https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/pickle/cleaned-data.pkl"
click node_products "https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/dataset/sample30.csv"
click node_vectorizer "https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/pickle/tfidf-vectorizer.pkl"
click node_classifier "https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/pickle/sentiment-classification-xg-boost-model.pkl"

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_flask,node_template,node_user toneBlue
class node_rec toneAmber
class node_sent,node_prep toneMint
class node_ratings,node_clean,node_products,node_vectorizer,node_classifier toneRose
```

## Components

### Web interface

- [Flask routes](https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/app.py): `app.py`
- [Web form and results](https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/templates/index.html): `templates/index.html`

### Recommendations

- [Product recommendations](https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/model.py): `model.py`

### Sentiment analysis

- [Review classification](https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/model.py): `model.py`
- [Text preprocessing](https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/model.py): `model.py`

### Data and models

- [User-product ratings](https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/pickle/user_final_rating.pkl): `pickle/user_final_rating.pkl`
- [Cleaned reviews](https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/pickle/cleaned-data.pkl): `pickle/cleaned-data.pkl`
- [Product details](https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/dataset/sample30.csv): `dataset/sample30.csv`
- [TF-IDF vectorizer](https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/pickle/tfidf-vectorizer.pkl): `pickle/tfidf-vectorizer.pkl`
- [Sentiment model](https://github.com/tulsi12/recommendationsystembasedonsentimentanalysis/blob/master/pickle/sentiment-classification-xg-boost-model.pkl): `pickle/sentiment-classification-xg-boost-model.pkl`

### Other components

- **User**

## Connections

- User → Flask routes: submits request (evidence: `app.py`)
- Flask routes → Web form and results: renders (evidence: `app.py`)
- Flask routes → Product recommendations: requests recommendations (evidence: `app.py`)
- Flask routes → Review classification: classifies review (evidence: `app.py`)
- Product recommendations → User-product ratings: reads ratings (evidence: `model.py`)
- Product recommendations → Cleaned reviews: filters reviews (evidence: `model.py`)
- Product recommendations → TF-IDF vectorizer: transforms reviews (evidence: `model.py`)
- Product recommendations → Sentiment model: predicts review sentiment (evidence: `model.py`)
- Product recommendations → Product details: joins product details (evidence: `model.py`)
- Review classification → Text preprocessing: preprocesses text (evidence: `model.py`)
- Review classification → TF-IDF vectorizer: transforms text (evidence: `model.py`)
- Review classification → Sentiment model: predicts sentiment (evidence: `model.py`)
- Text preprocessing → Text preprocessing: lemmatizes tokens (evidence: `model.py`)
