# yash-030/sentimental_analysis architecture

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

- Interactive diagram: https://gitdiagram.com/yash-030/sentimental_analysis
- Repository: https://github.com/yash-030/sentimental_analysis

## Overview

This Flask application accepts restaurant reviews in a web form and returns a positive/negative prediction. Its core runtime path is the POST handler calling sentiment prediction, which preprocesses the review, loads the saved TF-IDF vectorizer and Logistic Regression model, and predicts a label. A separate training path reads and preprocesses Reviews.csv and saves the fitted model. The README documents the form workflow; source excerpts establish the handler and model operations, but the HTML template itself was not sampled.

Main entry points: [`sentiment_analysis.py`](https://github.com/yash-030/sentimental_analysis/blob/master/sentiment_analysis.py) (Model training), [`app.py`](https://github.com/yash-030/sentimental_analysis/blob/master/app.py) (Flask routes), [`templates/index.html`](https://github.com/yash-030/sentimental_analysis/blob/master/templates/index.html) (Review form), [`model.pkl`](https://github.com/yash-030/sentimental_analysis/blob/master/model.pkl) (Saved classifier)

## Diagram (Mermaid)

```mermaid
flowchart TD

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

subgraph group_sentiment["Sentiment analysis"]
  node_predict["Sentiment prediction"]
  node_preprocess["Text preprocessing"]
  node_model[("Saved classifier<br/>[model.pkl]")]
end

subgraph group_training["Model training"]
  node_train["Model training"]
  node_dataset[("Review dataset<br/>[Reviews.csv]")]
end

node_user(("Review submitter"))

node_user -->|"enters review"| node_form
node_form -->|"submits review"| node_flask
node_flask -->|"renders result"| node_form
node_flask -->|"calls prediction"| node_predict
node_predict -->|"preprocesses text"| node_preprocess
node_predict -->|"loads classifier"| node_model
node_train -->|"reads reviews"| node_dataset
node_train -->|"preprocesses reviews"| node_preprocess
node_train -->|"saves classifier"| node_model

click node_form "https://github.com/yash-030/sentimental_analysis/blob/master/templates/index.html"
click node_flask "https://github.com/yash-030/sentimental_analysis/blob/master/app.py"
click node_predict "https://github.com/yash-030/sentimental_analysis/blob/master/sentiment_analysis.py"
click node_preprocess "https://github.com/yash-030/sentimental_analysis/blob/master/sentiment_analysis.py"
click node_model "https://github.com/yash-030/sentimental_analysis/blob/master/model.pkl"
click node_train "https://github.com/yash-030/sentimental_analysis/blob/master/sentiment_analysis.py"
click node_dataset "https://github.com/yash-030/sentimental_analysis/blob/master/Reviews.csv"

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_form,node_flask,node_user toneBlue
class node_predict,node_preprocess,node_model toneAmber
class node_train,node_dataset toneMint
```

## Components

### Web interface

- [Review form](https://github.com/yash-030/sentimental_analysis/blob/master/templates/index.html): `templates/index.html`
- [Flask routes](https://github.com/yash-030/sentimental_analysis/blob/master/app.py): `app.py`

### Sentiment analysis

- [Sentiment prediction](https://github.com/yash-030/sentimental_analysis/blob/master/sentiment_analysis.py): `sentiment_analysis.py`
- [Text preprocessing](https://github.com/yash-030/sentimental_analysis/blob/master/sentiment_analysis.py): `sentiment_analysis.py`
- [Saved classifier](https://github.com/yash-030/sentimental_analysis/blob/master/model.pkl): `model.pkl`

### Model training

- [Model training](https://github.com/yash-030/sentimental_analysis/blob/master/sentiment_analysis.py): `sentiment_analysis.py`
- [Review dataset](https://github.com/yash-030/sentimental_analysis/blob/master/Reviews.csv): `Reviews.csv`

### Other components

- **Review submitter**

## Connections

- Review submitter → Review form: enters review (evidence: `README.md`)
- Review form → Flask routes: submits review (evidence: `README.md`)
- Flask routes → Review form: renders result (evidence: `app.py`)
- Flask routes → Sentiment prediction: calls prediction (evidence: `app.py`)
- Sentiment prediction → Text preprocessing: preprocesses text (evidence: `sentiment_analysis.py`)
- Sentiment prediction → Saved classifier: loads classifier (evidence: `sentiment_analysis.py`)
- Model training → Review dataset: reads reviews (evidence: `sentiment_analysis.py`)
- Model training → Text preprocessing: preprocesses reviews (evidence: `sentiment_analysis.py`)
- Model training → Saved classifier: saves classifier (evidence: `sentiment_analysis.py`)
