# clive0707/cinematic-sentiment-analysis architecture

> Architecture diagram of the GitHub repository clive0707/cinematic-sentiment-analysis, 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/clive0707/cinematic-sentiment-analysis
- Repository: https://github.com/clive0707/cinematic-sentiment-analysis

## Overview

Marathi movie-review sentiment analysis web app: users submit a review through the dashboard, Flask routes it to the prediction engine, and the dashboard presents two model results, agreement, and similar reviews. Users can also download a PDF report; a separate training workflow builds the classifiers and evaluation metrics from the review dataset. The prediction source is partial, so internal prediction steps follow the documented features and visible calls without assuming additional module wiring.

Main entry points: [`predict.py`](https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/predict.py) (Prediction engine), [`train_model.py`](https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/train_model.py) (Training and evaluation), [`app.py`](https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/app.py) (Flask application), [`templates/index.html`](https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/templates/index.html) (Review dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_dashboard["Review dashboard<br/>[index.html]"]
  node_frontend["Dashboard interactions<br/>[script.js]"]
  node_flask["Flask application<br/>[app.py]"]
end

subgraph group_analysis["Sentiment analysis"]
  node_predictor["Prediction engine<br/>[predict.py]"]
  node_preprocess["Marathi text cleaning<br/>[preprocess.py]"]
  node_nb["Naive Bayes model"]
  node_lr["Logistic Regression model"]
  node_vectorizer["TF-IDF vectorizer"]
  node_similarity["Similar-review matching<br/>[predict.py]"]
  node_agreement["Agreement and evidence<br/>[predict.py]"]
end

subgraph group_training["Model training"]
  node_reviews["Review dataset"]
  node_trainer["Training and evaluation<br/>[train_model.py]"]
  node_metrics["Evaluation metrics<br/>[metrics.json]"]
end

subgraph group_reporting["Reports"]
  node_pdf["PDF report generator<br/>[pdf_generator.py]"]
end

node_user(("Reviewer"))

node_user -->|"enters review"| node_dashboard
node_dashboard -->|"uses interactions"| node_frontend
node_dashboard -->|"submits review"| node_flask
node_flask -->|"requests prediction"| node_predictor
node_predictor -->|"cleans review"| node_preprocess
node_predictor -->|"transforms review"| node_vectorizer
node_predictor -->|"loads and predicts"| node_nb
node_predictor -->|"loads and predicts"| node_lr
node_predictor -->|"matches reviews"| node_similarity
node_predictor -->|"compares outputs"| node_agreement
node_similarity -->|"searches corpus"| node_reviews
node_flask -->|"renders results"| node_dashboard
node_flask -->|"generates report"| node_pdf
node_flask -->|"provides metrics"| node_metrics
node_trainer -->|"reads reviews"| node_reviews
node_trainer -->|"cleans corpus"| node_preprocess
node_trainer -->|"fits and saves"| node_vectorizer
node_trainer -->|"trains and saves"| node_nb
node_trainer -->|"trains and saves"| node_lr
node_trainer -->|"evaluates and saves"| node_metrics

click node_dashboard "https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/templates/index.html"
click node_frontend "https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/static/script.js"
click node_flask "https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/app.py"
click node_predictor "https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/predict.py"
click node_preprocess "https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/preprocess.py"
click node_nb "https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/models/sentiment_model.pkl"
click node_lr "https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/models/logistic_regression_model.pkl"
click node_vectorizer "https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/models/tfidf_vectorizer.pkl"
click node_similarity "https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/predict.py"
click node_agreement "https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/predict.py"
click node_reviews "https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/dataset/marathi_movie_reviews.csv"
click node_trainer "https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/train_model.py"
click node_metrics "https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/models/metrics.json"
click node_pdf "https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/pdf_generator.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_dashboard,node_frontend,node_flask,node_user toneBlue
class node_predictor,node_preprocess,node_nb,node_lr,node_vectorizer,node_similarity,node_agreement toneAmber
class node_reviews,node_trainer,node_metrics toneMint
class node_pdf toneRose
```

## Components

### Web interface

- [Review dashboard](https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/templates/index.html): `templates/index.html`
- [Dashboard interactions](https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/static/script.js): `static/script.js`
- [Flask application](https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/app.py): `app.py`

### Sentiment analysis

- [Prediction engine](https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/predict.py): `predict.py`
- [Marathi text cleaning](https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/preprocess.py): `preprocess.py`
- [Naive Bayes model](https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/models/sentiment_model.pkl): `models/sentiment_model.pkl`
- [Logistic Regression model](https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/models/logistic_regression_model.pkl): `models/logistic_regression_model.pkl`
- [TF-IDF vectorizer](https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/models/tfidf_vectorizer.pkl): `models/tfidf_vectorizer.pkl`
- [Similar-review matching](https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/predict.py): `predict.py`
- [Agreement and evidence](https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/predict.py): `predict.py`

### Model training

- [Review dataset](https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/dataset/marathi_movie_reviews.csv): `dataset/marathi_movie_reviews.csv`
- [Training and evaluation](https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/train_model.py): `train_model.py`
- [Evaluation metrics](https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/models/metrics.json): `models/metrics.json`

### Reports

- [PDF report generator](https://github.com/clive0707/cinematic-sentiment-analysis/blob/main/pdf_generator.py): `pdf_generator.py`

### Other components

- **Reviewer**

## Connections

- Reviewer → Review dashboard: enters review
- Review dashboard → Dashboard interactions: uses interactions
- Review dashboard → Flask application: submits review
- Flask application → Prediction engine: requests prediction
- Prediction engine → Marathi text cleaning: cleans review
- Prediction engine → TF-IDF vectorizer: transforms review
- Prediction engine → Naive Bayes model: loads and predicts
- Prediction engine → Logistic Regression model: loads and predicts
- Prediction engine → Similar-review matching: matches reviews
- Prediction engine → Agreement and evidence: compares outputs
- Similar-review matching → Review dataset: searches corpus
- Flask application → Review dashboard: renders results
- Flask application → PDF report generator: generates report
- Flask application → Evaluation metrics: provides metrics
- Training and evaluation → Review dataset: reads reviews
- Training and evaluation → Marathi text cleaning: cleans corpus
- Training and evaluation → TF-IDF vectorizer: fits and saves
- Training and evaluation → Naive Bayes model: trains and saves
- Training and evaluation → Logistic Regression model: trains and saves
- Training and evaluation → Evaluation metrics: evaluates and saves
