# yousefdg005/qwqw architecture

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

- Interactive diagram: https://gitdiagram.com/yousefdg005/qwqw
- Repository: https://github.com/yousefdg005/qwqw

## Overview

AI Legal Workspace is a Streamlit application for bilingual legal-text alignment and terminology extraction. Users can create or upload aligned English–Arabic material, review alignment, generate TMX, and analyze aligned units with a selected AI model; results can be exported as a glossary or translation cards. The README documents these capabilities, while the excerpts show TMX generation, model-driven extraction, result filtering, and a dictionary request. Most runtime behavior lives in app.py, so internal stages are represented as components of that monolith; unsampled implementation details are not inferred.

Main entry points: [`app.py`](https://github.com/yousefdg005/qwqw/blob/main/app.py) (Streamlit workspace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_alignment["Alignment Studio"]
  node_alignment_input["Document alignment input<br/>[app.py]"]
  node_alignment_editor["Interactive alignment editor<br/>[app.py]"]
  node_tmx_generator["TMX generation<br/>[app.py]"]
  node_tmx_input["TMX upload and parsing<br/>[app.py]"]
end

subgraph group_extraction["Term Extraction"]
  node_model_choice["Model selection<br/>[app.py]"]
  node_legal_prompt["Legal prompt processing<br/>[app.py]"]
  node_term_extractor["AI term extraction<br/>[app.py]"]
  node_term_filter["Term filtering<br/>[app.py]"]
end

subgraph group_outputs["Glossary and Exports"]
  node_results["Structured term results<br/>[app.py]"]
  node_tmx_export["TMX download<br/>[app.py]"]
  node_excel_export["Excel glossary export<br/>[app.py]"]
  node_pdf_export["PDF term cards<br/>[app.py]"]
end

subgraph group_integrations["External Integrations"]
  node_openrouter{{"OpenRouter models"}}
  node_dictionary{{"Legal dictionary service"}}
end

node_user(("Legal workspace user"))
node_workspace["Streamlit workspace<br/>[app.py]"]

node_user -->|"uses"| node_workspace
node_workspace -->|"provides"| node_alignment_input
node_alignment_input -->|"aligns text"| node_alignment_editor
node_alignment_editor -->|"approves pairs"| node_tmx_generator
node_tmx_generator -->|"downloads TMX"| node_tmx_export
node_workspace -->|"accepts upload"| node_tmx_input
node_tmx_input -->|"supplies aligned units"| node_model_choice
node_workspace -->|"selects model"| node_model_choice
node_model_choice -.->|"chooses provider model"| node_openrouter
node_workspace -->|"prepares analysis"| node_legal_prompt
node_legal_prompt -->|"guides extraction"| node_term_extractor
node_term_extractor -.->|"requests analysis"| node_openrouter
node_term_extractor -->|"filters candidates"| node_term_filter
node_term_filter -->|"records terms"| node_results
node_results -->|"exports glossary"| node_excel_export
node_results -->|"exports cards"| node_pdf_export
node_workspace -.->|"sends dictionary entry"| node_dictionary

click node_workspace "https://github.com/yousefdg005/qwqw/blob/main/app.py"
click node_alignment_input "https://github.com/yousefdg005/qwqw/blob/main/app.py"
click node_alignment_editor "https://github.com/yousefdg005/qwqw/blob/main/app.py"
click node_tmx_generator "https://github.com/yousefdg005/qwqw/blob/main/app.py"
click node_tmx_input "https://github.com/yousefdg005/qwqw/blob/main/app.py"
click node_model_choice "https://github.com/yousefdg005/qwqw/blob/main/app.py"
click node_legal_prompt "https://github.com/yousefdg005/qwqw/blob/main/app.py"
click node_term_extractor "https://github.com/yousefdg005/qwqw/blob/main/app.py"
click node_term_filter "https://github.com/yousefdg005/qwqw/blob/main/app.py"
click node_results "https://github.com/yousefdg005/qwqw/blob/main/app.py"
click node_tmx_export "https://github.com/yousefdg005/qwqw/blob/main/app.py"
click node_excel_export "https://github.com/yousefdg005/qwqw/blob/main/app.py"
click node_pdf_export "https://github.com/yousefdg005/qwqw/blob/main/app.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_alignment_input,node_alignment_editor,node_tmx_generator,node_tmx_input,node_user toneBlue
class node_model_choice,node_legal_prompt,node_term_extractor,node_term_filter toneAmber
class node_results,node_tmx_export,node_excel_export,node_pdf_export toneMint
class node_openrouter,node_dictionary toneRose
class node_workspace toneTeal
```

## Components

### Alignment Studio

- [Document alignment input](https://github.com/yousefdg005/qwqw/blob/main/app.py): `app.py`
- [Interactive alignment editor](https://github.com/yousefdg005/qwqw/blob/main/app.py): `app.py`
- [TMX generation](https://github.com/yousefdg005/qwqw/blob/main/app.py): `app.py`
- [TMX upload and parsing](https://github.com/yousefdg005/qwqw/blob/main/app.py): `app.py`

### Term Extraction

- [Model selection](https://github.com/yousefdg005/qwqw/blob/main/app.py): `app.py`
- [Legal prompt processing](https://github.com/yousefdg005/qwqw/blob/main/app.py): `app.py`
- [AI term extraction](https://github.com/yousefdg005/qwqw/blob/main/app.py): `app.py`
- [Term filtering](https://github.com/yousefdg005/qwqw/blob/main/app.py): `app.py`

### Glossary and Exports

- [Structured term results](https://github.com/yousefdg005/qwqw/blob/main/app.py): `app.py`
- [TMX download](https://github.com/yousefdg005/qwqw/blob/main/app.py): `app.py`
- [Excel glossary export](https://github.com/yousefdg005/qwqw/blob/main/app.py): `app.py`
- [PDF term cards](https://github.com/yousefdg005/qwqw/blob/main/app.py): `app.py`

### External Integrations

- **OpenRouter models**
- **Legal dictionary service**

### Other components

- **Legal workspace user**
- [Streamlit workspace](https://github.com/yousefdg005/qwqw/blob/main/app.py): `app.py`

## Connections

- Legal workspace user → Streamlit workspace: uses (evidence: `README.md`)
- Streamlit workspace → Document alignment input: provides (evidence: `README.md`)
- Document alignment input → Interactive alignment editor: aligns text (evidence: `README.md`)
- Interactive alignment editor → TMX generation: approves pairs (evidence: `app.py`)
- TMX generation → TMX download: downloads TMX (evidence: `app.py`)
- Streamlit workspace → TMX upload and parsing: accepts upload (evidence: `README.md`)
- TMX upload and parsing → Model selection: supplies aligned units (evidence: `README.md`)
- Streamlit workspace → Model selection: selects model (evidence: `app.py`)
- Model selection → OpenRouter models: chooses provider model (evidence: `README.md`)
- Streamlit workspace → Legal prompt processing: prepares analysis (evidence: `README.md`)
- Legal prompt processing → AI term extraction: guides extraction (evidence: `README.md`)
- AI term extraction → OpenRouter models: requests analysis (evidence: `README.md`)
- AI term extraction → Term filtering: filters candidates (evidence: `app.py`)
- Term filtering → Structured term results: records terms (evidence: `app.py`)
- Structured term results → Excel glossary export: exports glossary (evidence: `README.md`)
- Structured term results → PDF term cards: exports cards (evidence: `README.md`)
- Streamlit workspace → Legal dictionary service: sends dictionary entry (evidence: `app.py`)
