# makshobela/linearalgebraproject architecture

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

- Interactive diagram: https://gitdiagram.com/makshobela/linearalgebraproject
- Repository: https://github.com/makshobela/linearalgebraproject

## Overview

This command-line application prepares Swiss German sentence data, trains one custom linear SVM per dialect, reports validation accuracy and errors, and can classify user-entered sentences. Its main workflow is orchestrated by main.py; preparation writes per-dialect feature files and a held-out test set, which training and validation use. The README also documents configurable training parameters and four target dialects. The graph follows the shown calls and file operations; it does not assume details of unsampled code.

Main entry points: [`main.py`](https://github.com/makshobela/linearalgebraproject/blob/main/main.py) (CLI orchestrator), [`src/prepare_data.py`](https://github.com/makshobela/linearalgebraproject/blob/main/src/prepare_data.py) (Dataset preparation), [`src/train_data.py`](https://github.com/makshobela/linearalgebraproject/blob/main/src/train_data.py) (Training coordinator), [`src/error_report.py`](https://github.com/makshobela/linearalgebraproject/blob/main/src/error_report.py) (Validation report)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_prepare["Dataset preparation<br/>[prepare_data.py]"]
  node_dialectfiles["Dialect feature files<br/>[prepare_data.py]"]
  node_testset["Held-out test set<br/>[prepare_data.py]"]
end

subgraph group_model["Dialect models"]
  node_trainer["Training coordinator<br/>[train_data.py]"]
  node_svm["Manual linear SVM<br/>[train_data.py]"]
  node_models["Trained dialect models<br/>[train_data.py]"]
end

subgraph group_use["Prediction and validation"]
  node_inference["Dialect prediction<br/>[inference.py]"]
  node_report["Validation report<br/>[error_report.py]"]
end

node_user(("CLI user"))
node_main["CLI orchestrator<br/>[main.py]"]
node_corpus[("Swiss dialect corpus")]

node_user -->|"sets options"| node_main
node_main -->|"prepares data"| node_prepare
node_corpus -->|"provides parquet"| node_prepare
node_prepare -->|"writes features"| node_dialectfiles
node_prepare -->|"writes split"| node_testset
node_main -->|"starts training"| node_trainer
node_dialectfiles -->|"supplies matrices"| node_trainer
node_trainer -->|"trains each dialect"| node_svm
node_trainer -->|"returns models"| node_models
node_main -->|"runs validation"| node_report
node_models -->|"supplies classifiers"| node_report
node_testset -->|"provides examples"| node_report
node_report -->|"predicts test rows"| node_inference
node_user -->|"enters sentences"| node_main
node_main -->|"requests prediction"| node_inference
node_models -->|"supplies classifiers"| node_inference

click node_main "https://github.com/makshobela/linearalgebraproject/blob/main/main.py"
click node_prepare "https://github.com/makshobela/linearalgebraproject/blob/main/src/prepare_data.py"
click node_dialectfiles "https://github.com/makshobela/linearalgebraproject/blob/main/src/prepare_data.py"
click node_testset "https://github.com/makshobela/linearalgebraproject/blob/main/src/prepare_data.py"
click node_trainer "https://github.com/makshobela/linearalgebraproject/blob/main/src/train_data.py"
click node_svm "https://github.com/makshobela/linearalgebraproject/blob/main/src/train_data.py"
click node_models "https://github.com/makshobela/linearalgebraproject/blob/main/src/train_data.py"
click node_inference "https://github.com/makshobela/linearalgebraproject/blob/main/src/inference.py"
click node_report "https://github.com/makshobela/linearalgebraproject/blob/main/src/error_report.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_prepare,node_dialectfiles,node_testset,node_user toneBlue
class node_trainer,node_svm,node_models,node_corpus toneAmber
class node_inference,node_report toneMint
class node_main toneTeal
```

## Components

### Data preparation

- [Dataset preparation](https://github.com/makshobela/linearalgebraproject/blob/main/src/prepare_data.py): `src/prepare_data.py`
- [Dialect feature files](https://github.com/makshobela/linearalgebraproject/blob/main/src/prepare_data.py): `src/prepare_data.py`
- [Held-out test set](https://github.com/makshobela/linearalgebraproject/blob/main/src/prepare_data.py): `src/prepare_data.py`

### Dialect models

- [Training coordinator](https://github.com/makshobela/linearalgebraproject/blob/main/src/train_data.py): `src/train_data.py`
- [Manual linear SVM](https://github.com/makshobela/linearalgebraproject/blob/main/src/train_data.py): `src/train_data.py`
- [Trained dialect models](https://github.com/makshobela/linearalgebraproject/blob/main/src/train_data.py): `src/train_data.py`

### Prediction and validation

- [Dialect prediction](https://github.com/makshobela/linearalgebraproject/blob/main/src/inference.py): `src/inference.py`
- [Validation report](https://github.com/makshobela/linearalgebraproject/blob/main/src/error_report.py): `src/error_report.py`

### Other components

- **CLI user**
- [CLI orchestrator](https://github.com/makshobela/linearalgebraproject/blob/main/main.py): `main.py`
- **Swiss dialect corpus**

## Connections

- CLI user → CLI orchestrator: sets options (evidence: `main.py`)
- CLI orchestrator → Dataset preparation: prepares data (evidence: `main.py`)
- Swiss dialect corpus → Dataset preparation: provides parquet
- Dataset preparation → Dialect feature files: writes features (evidence: `src/prepare_data.py`)
- Dataset preparation → Held-out test set: writes split (evidence: `src/prepare_data.py`)
- CLI orchestrator → Training coordinator: starts training (evidence: `main.py`)
- Dialect feature files → Training coordinator: supplies matrices (evidence: `src/train_data.py`)
- Training coordinator → Manual linear SVM: trains each dialect (evidence: `src/train_data.py`)
- Training coordinator → Trained dialect models: returns models (evidence: `src/train_data.py`)
- CLI orchestrator → Validation report: runs validation (evidence: `main.py`)
- Trained dialect models → Validation report: supplies classifiers (evidence: `main.py`)
- Held-out test set → Validation report: provides examples (evidence: `src/error_report.py`)
- Validation report → Dialect prediction: predicts test rows (evidence: `src/error_report.py`)
- CLI user → CLI orchestrator: enters sentences (evidence: `main.py`)
- CLI orchestrator → Dialect prediction: requests prediction (evidence: `main.py`)
- Trained dialect models → Dialect prediction: supplies classifiers (evidence: `main.py`)
