Metadata-Version: 2.4
Name: logiglyph
Version: 0.1.3
Summary: Agglutinative language toolkit with logical ASCII symbols and translator.
Author: Augusto
License-Expression: MIT
Keywords: conlang,translator,ascii-symbols,agglutinative-language
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Operating System :: OS Independent
Classifier: Topic :: Text Processing :: Linguistic
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: g4f>=0.3.2.7
Dynamic: license-file

# Agglutinative Language Toolkit

This project builds a small synthetic language and translates between:

- Normal English text (example: `the person builds a house`)
- ASCII language symbols (example: `lg_e_pa_`)

## Setup

```powershell
python -m venv .venv
.venv\Scripts\Activate.ps1
pip install -r requirements.txt
pip install -e .
```

## Generate Dictionary

```powershell
python -m src.tool generate-dictionary --count 96 --out data/dictionary.json
```

## Translate

```powershell
python -m src.tool translate --dict data/dictionary.json --text "the person builds a house"
python -m src.tool translate --dict data/dictionary.json --text "lg_e_pa_ lg_e_pan lg_e_pak" --reverse
```

The translator maps natural words through `aliases` in the dictionary, drops articles (`a`, `an`, `the`), and applies light lemmatization for common forms (`-s`, `-es`, `-ed`, `-ing`).

## Build Concept + Grammar References

```powershell
python -m src.tool build-language-pack --dict data/dictionary.json --concepts-out data/concepts.json --grammar-out data/grammar_reference.json
```

This writes:

- `data/concepts.json` (concept inventory, symbols, aliases, semantic classes)
- `data/grammar_reference.json` (translation conventions and symbol format)

## Dictionary Schema

Each entry in `data/dictionary.json` has:

- `root`: phonological root (`pa`, `pan`, ...)
- `gloss`: stable internal key (`person_0`, `house_1`, ...)
- `semantic_class`: one of `entity|action|quality|relation|abstract`
- `onset`, `vowel`, `coda`: compositional sound parts
- `symbol_id`: structured id (`entity:p:a:_`)
- `symbol`: deterministic ASCII symbol (`lg_<class>_<root>`)
- `aliases`: natural-language lookup words (example: `["person", "human", "people"]`)

## Python API

```python
from logiglyph import LanguageModule

lang = LanguageModule("data/dictionary.json")
res = lang.translate("the person builds a house near water")
print(res.text)               # e.g. lg_e_pa_ lg_a_pi_ lg_e_pan lg_r_pon lg_e_pak
print(lang.reverse(res.text)) # person make house near water
```
