# lokeshg018/text-to-text-conversion-after-rephrasing architecture

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

- Interactive diagram: https://gitdiagram.com/lokeshg018/text-to-text-conversion-after-rephrasing
- Repository: https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing

## Overview

RePhraseAI is a text paraphrasing application with a React interface, FastAPI backend, local FLAN-T5 generation, and quality/explainability features; it also includes a separate seq2seq and Transformer training/evaluation track. The principal user flow is text and style submission, generation, then viewing alternatives and analysis. The README documents the API capabilities and the overall generation stages. Source excerpts establish some internal calls; unsampled route and page details are represented only where documented, so their specific internal wiring is not inferred.

Main entry points: [`backend/app/services/rephrase_service.py`](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/services/rephrase_service.py) (FLAN-T5 generation), [`frontend/src/services/api.js`](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/frontend/src/services/api.js) (API client), [`backend/app/main.py`](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/main.py) (FastAPI application), [`backend/app/routes/rephrase.py`](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/routes/rephrase.py) (Rephrase routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["User interface"]
  node_app["React application<br/>[App.jsx]"]
  node_rephraser["Rephraser screen<br/>[Rephraser.jsx]"]
  node_rephrase_hook["Rephrase state<br/>[useRephrase.js]"]
  node_api_client["API client<br/>[api.js]"]
  node_results["Results and metrics<br/>[MetricsPanel.jsx]"]
  node_auth_context["Auth state<br/>[AuthContext.jsx]"]
  node_auth_screen["Login and signup<br/>[AuthPage.jsx]"]
end

subgraph group_backend["API and accounts"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_auth_routes["Authentication routes<br/>[auth.py]"]
  node_rephrase_routes["Rephrase routes<br/>[rephrase.py]"]
  node_history_routes["History routes<br/>[history.py]"]
  node_database[("SQLAlchemy database<br/>[database.py]")]
  node_models["ORM models<br/>[history.py]"]
end

subgraph group_generation["Generation and analysis"]
  node_generation_service["FLAN-T5 generation"]
  node_preprocessing["Text preprocessing<br/>[preprocessing.py]"]
  node_prompts["Style prompts<br/>[prompt_service.py]"]
  node_analysis["Explainability and analytics"]
  node_evaluation["Quality evaluation"]
end

subgraph group_training["Model training"]
  node_dataset_prep["Training data preparation<br/>[preprocessing.py]"]
  node_seq2seq["LSTM and GRU seq2seq<br/>[rnn_seq2seq.py]"]
  node_transformer_training["FLAN-T5 fine-tuning"]
  node_model_evaluation["Model comparison<br/>[evaluate.py]"]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -.->|"offers"| node_rephraser
node_rephraser -.->|"submits text"| node_rephrase_hook
node_rephrase_hook -->|"calls"| node_api_client
node_api_client -->|"POSTs rephrase"| node_rephrase_routes
node_api_client -->|"calls auth endpoints"| node_auth_routes
node_api_client -->|"calls history endpoints"| node_history_routes
node_rephrase_routes -.->|"requests generation"| node_generation_service
node_generation_service -->|"chunks text"| node_preprocessing
node_generation_service -->|"builds prompts"| node_prompts
node_generation_service -->|"post-processes output"| node_analysis
node_generation_service -.->|"returns candidates"| node_results
node_evaluation -->|"measures lexical change"| node_analysis
node_api_app -->|"registers router"| node_auth_routes
node_api_app -->|"registers router"| node_rephrase_routes
node_api_app -->|"registers router"| node_history_routes
node_api_app -->|"creates tables"| node_database
node_auth_screen -->|"invokes login"| node_auth_context
node_auth_context -->|"calls auth API"| node_api_client
node_dataset_prep -.->|"prepares training data"| node_seq2seq
node_dataset_prep -.->|"prepares training data"| node_transformer_training
node_seq2seq -.->|"compared by"| node_model_evaluation
node_transformer_training -.->|"compared by"| node_model_evaluation

click node_app "https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/frontend/src/App.jsx"
click node_rephraser "https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/frontend/src/pages/Rephraser.jsx"
click node_rephrase_hook "https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/frontend/src/hooks/useRephrase.js"
click node_api_client "https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/frontend/src/services/api.js"
click node_results "https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/frontend/src/components/MetricsPanel.jsx"
click node_auth_context "https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/frontend/src/context/AuthContext.jsx"
click node_auth_screen "https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/frontend/src/pages/AuthPage.jsx"
click node_api_app "https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/main.py"
click node_auth_routes "https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/routes/auth.py"
click node_rephrase_routes "https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/routes/rephrase.py"
click node_history_routes "https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/routes/history.py"
click node_database "https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/database.py"
click node_models "https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/models/history.py"
click node_generation_service "https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/services/rephrase_service.py"
click node_preprocessing "https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/services/preprocessing.py"
click node_prompts "https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/services/prompt_service.py"
click node_analysis "https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/services/analysis_service.py"
click node_evaluation "https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/services/evaluation_service.py"
click node_dataset_prep "https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/training/preprocessing.py"
click node_seq2seq "https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/training/rnn_seq2seq.py"
click node_transformer_training "https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/training/train_transformer.py"
click node_model_evaluation "https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/training/evaluate.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_app,node_rephraser,node_rephrase_hook,node_api_client,node_results,node_auth_context,node_auth_screen,node_user toneBlue
class node_api_app,node_auth_routes,node_rephrase_routes,node_history_routes,node_database,node_models toneAmber
class node_generation_service,node_preprocessing,node_prompts,node_analysis,node_evaluation toneMint
class node_dataset_prep,node_seq2seq,node_transformer_training,node_model_evaluation toneRose
```

## Components

### User interface

- [React application](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Rephraser screen](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/frontend/src/pages/Rephraser.jsx): `frontend/src/pages/Rephraser.jsx`
- [Rephrase state](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/frontend/src/hooks/useRephrase.js): `frontend/src/hooks/useRephrase.js`
- [API client](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Results and metrics](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/frontend/src/components/MetricsPanel.jsx): `frontend/src/components/MetricsPanel.jsx`
- [Auth state](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Login and signup](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/frontend/src/pages/AuthPage.jsx): `frontend/src/pages/AuthPage.jsx`

### API and accounts

- [FastAPI application](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication routes](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/routes/auth.py): `backend/app/routes/auth.py`
- [Rephrase routes](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/routes/rephrase.py): `backend/app/routes/rephrase.py`
- [History routes](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/routes/history.py): `backend/app/routes/history.py`
- [SQLAlchemy database](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/database.py): `backend/app/database.py`
- [ORM models](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/models/history.py): `backend/app/models/history.py`

### Generation and analysis

- [FLAN-T5 generation](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/services/rephrase_service.py): `backend/app/services/rephrase_service.py`
- [Text preprocessing](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/services/preprocessing.py): `backend/app/services/preprocessing.py`
- [Style prompts](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/services/prompt_service.py): `backend/app/services/prompt_service.py`
- [Explainability and analytics](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/services/analysis_service.py): `backend/app/services/analysis_service.py`
- [Quality evaluation](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/backend/app/services/evaluation_service.py): `backend/app/services/evaluation_service.py`

### Model training

- [Training data preparation](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/training/preprocessing.py): `training/preprocessing.py`
- [LSTM and GRU seq2seq](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/training/rnn_seq2seq.py): `training/rnn_seq2seq.py`
- [FLAN-T5 fine-tuning](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/training/train_transformer.py): `training/train_transformer.py`
- [Model comparison](https://github.com/lokeshg018/text-to-text-conversion-after-rephrasing/blob/main/training/evaluate.py): `training/evaluate.py`

### Other components

- **User**

## Connections

- User → React application: uses
- React application → Rephraser screen: offers
- Rephraser screen → Rephrase state: submits text
- Rephrase state → API client: calls (evidence: `frontend/src/hooks/useRephrase.js`)
- API client → Rephrase routes: POSTs rephrase
- API client → Authentication routes: calls auth endpoints
- API client → History routes: calls history endpoints
- Rephrase routes → FLAN-T5 generation: requests generation
- FLAN-T5 generation → Text preprocessing: chunks text (evidence: `backend/app/services/rephrase_service.py`)
- FLAN-T5 generation → Style prompts: builds prompts (evidence: `backend/app/services/rephrase_service.py`)
- FLAN-T5 generation → Explainability and analytics: post-processes output (evidence: `backend/app/services/rephrase_service.py`)
- FLAN-T5 generation → Results and metrics: returns candidates
- Quality evaluation → Explainability and analytics: measures lexical change (evidence: `backend/app/services/evaluation_service.py`)
- FastAPI application → Authentication routes: registers router (evidence: `backend/app/main.py`)
- FastAPI application → Rephrase routes: registers router (evidence: `backend/app/main.py`)
- FastAPI application → History routes: registers router (evidence: `backend/app/main.py`)
- FastAPI application → SQLAlchemy database: creates tables (evidence: `backend/app/main.py`)
- Login and signup → Auth state: invokes login (evidence: `frontend/src/pages/AuthPage.jsx`)
- Auth state → API client: calls auth API (evidence: `frontend/src/context/AuthContext.jsx`)
- Training data preparation → LSTM and GRU seq2seq: prepares training data
- Training data preparation → FLAN-T5 fine-tuning: prepares training data
- LSTM and GRU seq2seq → Model comparison: compared by (evidence: `training/evaluate.py`)
- FLAN-T5 fine-tuning → Model comparison: compared by (evidence: `training/evaluate.py`)
