# sanskarkudache9317-cloud/ai-sentiment-analyzer architecture

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

- Interactive diagram: https://gitdiagram.com/sanskarkudache9317-cloud/ai-sentiment-analyzer
- Repository: https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer

## Overview

This is a review sentiment analyzer with web and CLI entry points. A review is submitted or entered, checked and scored by a selected engine, mapped to a sentiment label, then presented with score, confidence, and explanation; the web app also keeps recent results. The custom lexicon and VADER engines are distinct analysis paths, with VADER falling back to the custom engine when unavailable. The README documents CLI demo and batch modes and the web history/result features. Unsampled templates are included based on documented routes and rendering; implementation details beyond shown code are not inferred.

Main entry points: [`app.py`](https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/app.py) (Flask routes), [`main.py`](https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/main.py) (CLI modes), [`sentiment/vader_engine.py`](https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/sentiment/vader_engine.py) (VADER engine), [`sentiment/lexicon_engine.py`](https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/sentiment/lexicon_engine.py) (Custom lexicon engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User Interfaces"]
  node_cli["CLI modes<br/>[main.py]"]
  node_web["Flask routes<br/>[app.py]"]
  node_validation["Review validation<br/>[app.py]"]
end

subgraph group_analysis["Sentiment Analysis"]
  node_custom["Custom lexicon engine<br/>[lexicon_engine.py]"]
  node_vader["VADER engine<br/>[vader_engine.py]"]
  node_classifier["Score classifier<br/>[classifier.py]"]
end

subgraph group_presentation["Results and Guidance"]
  node_history["Recent web history<br/>[app.py]"]
  node_webview["Review form and results<br/>[index.html]"]
  node_about["Scoring explanation<br/>[about.html]"]
  node_clioutput["CLI report<br/>[main.py]"]
end

subgraph group_resources["Sentiment Data"]
  node_vaderdata["VADER lexicon data<br/>[vader_lexicon.zip]"]
end

node_user(("Review submitter"))

node_user -->|"enters review"| node_webview
node_webview -->|"submits form"| node_web
node_web -->|"validates input"| node_validation
node_validation -->|"analyzes review"| node_custom
node_validation -->|"selects engine"| node_vader
node_custom -->|"clamps score"| node_classifier
node_vader -->|"clamps score"| node_classifier
node_vader -->|"falls back"| node_custom
node_web -->|"labels score"| node_classifier
node_web -->|"records result"| node_history
node_web -->|"renders result"| node_webview
node_web -->|"renders page"| node_about
node_user -->|"enters review"| node_cli
node_cli -->|"analyzes review"| node_custom
node_cli -->|"selects engine"| node_vader
node_cli -->|"labels score"| node_classifier
node_cli -->|"prints report"| node_clioutput
node_vader -.->|"loads lexicon"| node_vaderdata

click node_cli "https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/main.py"
click node_web "https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/app.py"
click node_validation "https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/app.py"
click node_custom "https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/sentiment/lexicon_engine.py"
click node_vader "https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/sentiment/vader_engine.py"
click node_classifier "https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/sentiment/classifier.py"
click node_history "https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/app.py"
click node_webview "https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/templates/index.html"
click node_about "https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/templates/about.html"
click node_clioutput "https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/main.py"
click node_vaderdata "https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/nltk_data/sentiment/vader_lexicon.zip"

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_cli,node_web,node_validation,node_user toneBlue
class node_custom,node_vader,node_classifier toneAmber
class node_history,node_webview,node_about,node_clioutput toneMint
class node_vaderdata toneRose
```

## Components

### User Interfaces

- [CLI modes](https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/main.py): `main.py`
- [Flask routes](https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/app.py): `app.py`
- [Review validation](https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/app.py): `app.py`

### Sentiment Analysis

- [Custom lexicon engine](https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/sentiment/lexicon_engine.py): `sentiment/lexicon_engine.py`
- [VADER engine](https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/sentiment/vader_engine.py): `sentiment/vader_engine.py`
- [Score classifier](https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/sentiment/classifier.py): `sentiment/classifier.py`

### Results and Guidance

- [Recent web history](https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/app.py): `app.py`
- [Review form and results](https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/templates/index.html): `templates/index.html`
- [Scoring explanation](https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/templates/about.html): `templates/about.html`
- [CLI report](https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/main.py): `main.py`

### Sentiment Data

- [VADER lexicon data](https://github.com/sanskarkudache9317-cloud/ai-sentiment-analyzer/blob/main/nltk_data/sentiment/vader_lexicon.zip): `nltk_data/sentiment/vader_lexicon.zip`

### Other components

- **Review submitter**

## Connections

- Review submitter → Review form and results: enters review (evidence: `README.md`)
- Review form and results → Flask routes: submits form (evidence: `app.py`)
- Flask routes → Review validation: validates input (evidence: `app.py`)
- Review validation → Custom lexicon engine: analyzes review (evidence: `app.py`)
- Review validation → VADER engine: selects engine (evidence: `app.py`)
- Custom lexicon engine → Score classifier: clamps score (evidence: `sentiment/lexicon_engine.py`)
- VADER engine → Score classifier: clamps score (evidence: `sentiment/vader_engine.py`)
- VADER engine → Custom lexicon engine: falls back (evidence: `sentiment/vader_engine.py`)
- Flask routes → Score classifier: labels score (evidence: `app.py`)
- Flask routes → Recent web history: records result (evidence: `app.py`)
- Flask routes → Review form and results: renders result (evidence: `app.py`)
- Flask routes → Scoring explanation: renders page (evidence: `README.md`)
- Review submitter → CLI modes: enters review (evidence: `README.md`)
- CLI modes → Custom lexicon engine: analyzes review (evidence: `main.py`)
- CLI modes → VADER engine: selects engine (evidence: `main.py`)
- CLI modes → Score classifier: labels score (evidence: `main.py`)
- CLI modes → CLI report: prints report (evidence: `main.py`)
- VADER engine → VADER lexicon data: loads lexicon
