# frozsgy/semantle-tr architecture

> Architecture diagram of the GitHub repository frozsgy/semantle-tr, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/frozsgy/semantle-tr
- Repository: https://github.com/frozsgy/semantle-tr

## Overview

##### Project type and purpose
- This is a full-stack web application (“Semantle Türkçe”) that serves a word-guessing game backed by semantic similarity.
- The README and file tree show a Python backend, a static/templated frontend, a SQLite data store initialized from Word2Vec vectors and hint-generation scripts, and a Docker-based deployment.

##### File structure
Top-level:
- Dockerfile, docker-compose.yml, .dockerignore – container and orchestration setup.
- semantle.py – the main Python web service (likely a Flask or similar WSGI app).
- requirements.txt – Python dependencies.
- conf.d/semantle-tr.conf – webserver (e.g. Nginx) configuration.
- dump-vecs.py, dump-hints.py, store-hints.py – data-preparation scripts that train/load vectors, generate hints, and populate the SQLite DB.
- word2vec/ – model-training code (train.py, train.sh for Wikipedia corpus).
- static/ & templates/ – frontend UI delivered via HTML, CSS, JavaScript and Jinja2 templates.

##### README for additional insights
- Describes a pipeline: train Word2Vec → dump vectors → generate hints → import hints → run Docker-Compose to serve the app.
- Dependencies are purely Python and a local SQLite DB; no external SaaS beyond the open Wikipedia dump.

##### Elements
- Model → Dump Scripts → DB
- Browser → Nginx → Backend → DB → Backend → Browser
- Blue for data pipelines
- Green for runtime services
- Orange for storage
- Purple for frontend/UI

## Diagram (Mermaid)

```mermaid
graph TB

    subgraph "Data Engineering"
        WT1["train.py"]:::data
        WT2["train.sh"]:::data
        VOC["tr_50k.txt"]:::data
        DV["dump-vecs.py"]:::data
        DH["dump-hints.py"]:::data
        SH["store-hints.py"]:::data
    end

    subgraph "Persistence"
        DB["SQLite DB<br/>(semantle.db)"]:::storage
    end

    subgraph "Application Layer"
        NG["Nginx (conf.d/semantle-tr.conf)"]:::service
        APP["Flask App (semantle.py)"]:::service
    end

    subgraph "Presentation Layer"
        STATIC["static/"]:::frontend
        TEMPLATE["templates/top1k.html"]:::frontend
        BROWSER["Browser UI"]:::frontend
    end

    subgraph "Deployment & Orchestration"
        DF["Dockerfile"]:::deployment
        DC["docker-compose.yml"]:::deployment
        DI[".dockerignore"]:::deployment
        GI[".gitignore"]:::deployment
    end

    %% Data pipeline flows
    WT1 --> DV
    WT2 --> DV
    VOC --> DV
    DV --> DB
    DH --> SH
    SH --> DB

    %% Runtime interactions
    BROWSER --> NG
    NG --> APP
    APP --> DB
    APP --> BROWSER
    STATIC --> BROWSER

    %% Deployment connections
    DF --> APP
    DC --> APP
    DC --> NG
    DI --> DF
    GI --> DF

    %% Click Events
    click WT1 "https://github.com/frozsgy/semantle-tr/blob/main/word2vec/train.py"
    click WT2 "https://github.com/frozsgy/semantle-tr/blob/main/word2vec/train.sh"
    click DV "https://github.com/frozsgy/semantle-tr/blob/main/dump-vecs.py"
    click DH "https://github.com/frozsgy/semantle-tr/blob/main/dump-hints.py"
    click SH "https://github.com/frozsgy/semantle-tr/blob/main/store-hints.py"
    click VOC "https://github.com/frozsgy/semantle-tr/blob/main/tr_50k.txt"
    click APP "https://github.com/frozsgy/semantle-tr/blob/main/semantle.py"
    click NG "https://github.com/frozsgy/semantle-tr/blob/main/conf.d/semantle-tr.conf"
    click STATIC "https://github.com/frozsgy/semantle-tr/tree/main/static/"
    click TEMPLATE "https://github.com/frozsgy/semantle-tr/blob/main/templates/top1k.html"
    click DF "https://github.com/frozsgy/semantle-tr/tree/main/Dockerfile"
    click DC "https://github.com/frozsgy/semantle-tr/blob/main/docker-compose.yml"
    click DI "https://github.com/frozsgy/semantle-tr/blob/main/.dockerignore"
    click GI "https://github.com/frozsgy/semantle-tr/blob/main/.gitignore"

    classDef data fill:#cce5ff,stroke:#004085
    classDef service fill:#d4edda,stroke:#155724
    classDef storage fill:#fff3cd,stroke:#856404
    classDef frontend fill:#f5c6cb,stroke:#721c24
    classDef deployment fill:#e2e3e5,stroke:#6c757d
```
