# toca-toca/ithkuil-translator architecture

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

- Interactive diagram: https://gitdiagram.com/toca-toca/ithkuil-translator
- Repository: https://github.com/toca-toca/ithkuil-translator

## Overview

This is a bidirectional English ↔ New Ithkuil IV translator. The main forward workflow parses English into a validated semantic plan, compiles formatives into Ithkuil morphology, then renders a schematic SVG/PNG; reverse mode decompiles Ithkuil into literal English, with optional LLM phrasing. The graph preserves the documented parser backends and the compiler’s morphology subsystems. Some internal call details are not visible in the excerpts, so only documented or indexed relationships are shown; optional integrations are dashed where wiring is not established.

Main entry points: [`src/ithkuil_translator/cli.py`](https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/cli.py) (Translator CLI), [`src/ithkuil_translator/parser.py`](https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/parser.py) (Semantic Parsers), [`src/ithkuil_translator/morphology.py`](https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/morphology.py) (Morphological Compiler), [`src/ithkuil_translator/decompiler.py`](https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/decompiler.py) (Morphological Decompiler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interface"]
  node_cli["Translator CLI<br/>[cli.py]"]
end

subgraph group_semantics["Semantic Parsing"]
  node_parser["Semantic Parsers<br/>[parser.py]"]
  node_schemas["Translation Schemas<br/>[schemas.py]"]
end

subgraph group_morphology["Morphology"]
  node_compiler["Morphological Compiler<br/>[morphology.py]"]
  node_lexicon[("Roots and Affixes<br/>[lexicon.py]")]
  node_lexicon_data[("Lexicon Data")]
  node_ca["Ca and Vr Forms<br/>[ca.py]"]
  node_categories["Category Affixes<br/>[categories.py]"]
  node_register["Register Marking<br/>[register.py]"]
end

subgraph group_outputs["Translation Outputs"]
  node_decompiler["Morphological Decompiler<br/>[decompiler.py]"]
  node_renderer["Schematic Renderer<br/>[svg_script.py]"]
end

node_user(("User"))
node_llama["llama.cpp"]
node_ollama["Ollama"]
node_gemini["Gemini API"]
node_english["English Result"]
node_ithkuil["Ithkuil Result"]

node_user -->|"provides text"| node_cli
node_cli -->|"selects backend"| node_parser
node_parser -->|"queries"| node_llama
node_parser -->|"queries"| node_ollama
node_parser -->|"queries"| node_gemini
node_parser -->|"validates plan"| node_schemas
node_cli -->|"compiles plan"| node_compiler
node_compiler -->|"looks up forms"| node_lexicon
node_lexicon -->|"loads entries"| node_lexicon_data
node_compiler -->|"encodes Ca and Vr"| node_ca
node_compiler -->|"resolves categories"| node_categories
node_compiler -->|"applies register"| node_register
node_cli -->|"renders compiled forms"| node_renderer
node_renderer -->|"writes SVG or PNG"| node_ithkuil
node_cli -->|"prints translation"| node_ithkuil
node_cli -->|"decodes input"| node_decompiler
node_decompiler -->|"looks up forms"| node_lexicon
node_decompiler -->|"produces breakdown"| node_english
node_cli -.->|"polishes English"| node_parser
node_cli -->|"prints translation"| node_english

click node_cli "https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/cli.py"
click node_parser "https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/parser.py"
click node_schemas "https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/schemas.py"
click node_compiler "https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/morphology.py"
click node_lexicon "https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/lexicon.py"
click node_lexicon_data "https://github.com/toca-toca/ithkuil-translator/tree/main/src/ithkuil_translator/data"
click node_ca "https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/ca.py"
click node_categories "https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/categories.py"
click node_register "https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/register.py"
click node_decompiler "https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/decompiler.py"
click node_renderer "https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/svg_script.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_cli,node_user toneBlue
class node_parser,node_schemas toneAmber
class node_compiler,node_lexicon,node_lexicon_data,node_ca,node_categories,node_register,node_gemini toneMint
class node_decompiler,node_renderer toneRose
class node_llama,node_ollama,node_english,node_ithkuil toneIndigo
```

## Components

### User Interface

- [Translator CLI](https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/cli.py): `src/ithkuil_translator/cli.py`

### Semantic Parsing

- [Semantic Parsers](https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/parser.py): `src/ithkuil_translator/parser.py`
- [Translation Schemas](https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/schemas.py): `src/ithkuil_translator/schemas.py`

### Morphology

- [Morphological Compiler](https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/morphology.py): `src/ithkuil_translator/morphology.py`
- [Roots and Affixes](https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/lexicon.py): `src/ithkuil_translator/lexicon.py`
- [Lexicon Data](https://github.com/toca-toca/ithkuil-translator/tree/main/src/ithkuil_translator/data): `src/ithkuil_translator/data`
- [Ca and Vr Forms](https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/ca.py): `src/ithkuil_translator/ca.py`
- [Category Affixes](https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/categories.py): `src/ithkuil_translator/categories.py`
- [Register Marking](https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/register.py): `src/ithkuil_translator/register.py`

### Translation Outputs

- [Morphological Decompiler](https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/decompiler.py): `src/ithkuil_translator/decompiler.py`
- [Schematic Renderer](https://github.com/toca-toca/ithkuil-translator/blob/main/src/ithkuil_translator/svg_script.py): `src/ithkuil_translator/svg_script.py`

### Other components

- **User**
- **llama.cpp**
- **Ollama**
- **Gemini API**
- **English Result**
- **Ithkuil Result**

## Connections

- User → Translator CLI: provides text (evidence: `README.md`)
- Translator CLI → Semantic Parsers: selects backend (evidence: `src/ithkuil_translator/cli.py`)
- Semantic Parsers → llama.cpp: queries (evidence: `README.md`)
- Semantic Parsers → Ollama: queries (evidence: `README.md`)
- Semantic Parsers → Gemini API: queries (evidence: `README.md`)
- Semantic Parsers → Translation Schemas: validates plan (evidence: `README.md`)
- Translator CLI → Morphological Compiler: compiles plan (evidence: `README.md`)
- Morphological Compiler → Roots and Affixes: looks up forms (evidence: `README.md`)
- Roots and Affixes → Lexicon Data: loads entries (evidence: `src/ithkuil_translator/lexicon.py`)
- Morphological Compiler → Ca and Vr Forms: encodes Ca and Vr (evidence: `src/ithkuil_translator/morphology.py`)
- Morphological Compiler → Category Affixes: resolves categories (evidence: `src/ithkuil_translator/morphology.py`)
- Morphological Compiler → Register Marking: applies register (evidence: `src/ithkuil_translator/morphology.py`)
- Translator CLI → Schematic Renderer: renders compiled forms (evidence: `README.md`)
- Schematic Renderer → Ithkuil Result: writes SVG or PNG (evidence: `README.md`)
- Translator CLI → Ithkuil Result: prints translation (evidence: `README.md`)
- Translator CLI → Morphological Decompiler: decodes input (evidence: `README.md`)
- Morphological Decompiler → Roots and Affixes: looks up forms (evidence: `src/ithkuil_translator/decompiler.py`)
- Morphological Decompiler → English Result: produces breakdown (evidence: `README.md`)
- Translator CLI → Semantic Parsers: polishes English (evidence: `src/ithkuil_translator/cli.py`)
- Translator CLI → English Result: prints translation (evidence: `README.md`)
