# sharvarisalkar/emoji_text_predictor architecture

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

- Interactive diagram: https://gitdiagram.com/sharvarisalkar/emoji_text_predictor
- Repository: https://github.com/sharvarisalkar/emoji_text_predictor

## Overview

Emoji Text Predictor is a small Flask app that accepts text in a web form and returns semantically matched emojis. The runtime route passes submitted text to word-level SBERT matching, which compares embeddings against precomputed emoji-keyword vectors and maps the best match to emoji characters. A separate training script encodes the keyword list and saves vectors for runtime use. The README describes additional preprocessing, but the sampled runtime code only lowercases, splits, and skips common words; the HTML template was not sampled, so UI details are limited to documented behavior.

Main entry points: [`run.py`](https://github.com/sharvarisalkar/emoji_text_predictor/blob/main/run.py) (Flask route), [`train.py`](https://github.com/sharvarisalkar/emoji_text_predictor/blob/main/train.py) (Vector preparation), [`index.html`](https://github.com/sharvarisalkar/emoji_text_predictor/blob/main/index.html) (Text form), [`emoji_data.py`](https://github.com/sharvarisalkar/emoji_text_predictor/blob/main/emoji_data.py) (Emoji catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_form["Text form<br/>[index.html]"]
  node_flask["Flask route<br/>[run.py]"]
end

subgraph group_matching["Emoji matching"]
  node_word_match["Word matcher<br/>[run.py]"]
  node_sbert["SBERT encoder"]
  node_similarity["Similarity ranking<br/>[run.py]"]
end

subgraph group_vectors["Embedding data"]
  node_emoji_data["Emoji catalog<br/>[emoji_data.py]"]
  node_vector_prep["Vector preparation<br/>[train.py]"]
end

node_user(("Text user"))

node_user -->|"enters text"| node_form
node_form -->|"submits text"| node_flask
node_flask -->|"calls"| node_word_match
node_flask -->|"renders result"| node_form
node_word_match -->|"encodes words"| node_sbert
node_word_match -->|"scores vectors"| node_similarity
node_similarity -->|"maps best match"| node_emoji_data
node_vector_prep -->|"encodes keywords"| node_emoji_data
node_vector_prep -->|"encodes keywords"| node_sbert
node_flask -->|"loads saved vectors"| node_vector_prep

click node_form "https://github.com/sharvarisalkar/emoji_text_predictor/blob/main/index.html"
click node_flask "https://github.com/sharvarisalkar/emoji_text_predictor/blob/main/run.py"
click node_word_match "https://github.com/sharvarisalkar/emoji_text_predictor/blob/main/run.py"
click node_emoji_data "https://github.com/sharvarisalkar/emoji_text_predictor/blob/main/emoji_data.py"
click node_vector_prep "https://github.com/sharvarisalkar/emoji_text_predictor/blob/main/train.py"
click node_similarity "https://github.com/sharvarisalkar/emoji_text_predictor/blob/main/run.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_form,node_flask,node_user toneBlue
class node_word_match,node_sbert,node_similarity toneAmber
class node_emoji_data,node_vector_prep toneMint
```

## Components

### Web interface

- [Text form](https://github.com/sharvarisalkar/emoji_text_predictor/blob/main/index.html): `index.html`
- [Flask route](https://github.com/sharvarisalkar/emoji_text_predictor/blob/main/run.py): `run.py`

### Emoji matching

- [Word matcher](https://github.com/sharvarisalkar/emoji_text_predictor/blob/main/run.py): `run.py`
- **SBERT encoder**
- [Similarity ranking](https://github.com/sharvarisalkar/emoji_text_predictor/blob/main/run.py): `run.py`

### Embedding data

- [Emoji catalog](https://github.com/sharvarisalkar/emoji_text_predictor/blob/main/emoji_data.py): `emoji_data.py`
- [Vector preparation](https://github.com/sharvarisalkar/emoji_text_predictor/blob/main/train.py): `train.py`

### Other components

- **Text user**

## Connections

- Text user → Text form: enters text (evidence: `README.md`)
- Text form → Flask route: submits text (evidence: `README.md`)
- Flask route → Word matcher: calls (evidence: `run.py`)
- Flask route → Text form: renders result (evidence: `run.py`)
- Word matcher → SBERT encoder: encodes words (evidence: `run.py`)
- Word matcher → Similarity ranking: scores vectors (evidence: `run.py`)
- Similarity ranking → Emoji catalog: maps best match (evidence: `run.py`)
- Vector preparation → Emoji catalog: encodes keywords (evidence: `train.py`)
- Vector preparation → SBERT encoder: encodes keywords (evidence: `train.py`)
- Flask route → Vector preparation: loads saved vectors (evidence: `run.py`)
