Metadata-Version: 2.4
Name: glossa-lang
Version: 0.1.0
Summary: Encode and decode a constructed language: word substitution, word-order shift, invented alphabet.
License-Expression: MIT
Keywords: conlang,constructed-language,cipher,encoder,decoder,cli
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Text Processing :: Linguistic
Classifier: Topic :: Utilities
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
Dynamic: license-file

# glossa

Your own constructed language, in the terminal. Encoding runs three stages:

1. **Word substitution** — every word is swapped for an invented one (coined on first sight, remembered forever).
2. **Word order shift** — the sentence is re-ordered by a reversible rule.
3. **Invented alphabet** — the result is written in a 26-symbol script of its own.

Decoding runs the exact inverse, so text survives a round trip — punctuation, capitalisation, numbers, and line breaks included.

```
$ glossa -code "Hello John, I eat bread!"
ⵈⵅⴷⴹⵖⴹ ⵁⵋⴽⵋ ◆ⵃⵅⵒⵂ ◆ⴵⴾⵔⵅ, ◆ⴴⵅⴷⵋⵊⴹⵃ!

$ glossa -code "Hello John, I eat bread!" | glossa -decode
Hello John, I eat bread!
```

## Install

```bash
pip install glossa-lang
```

The distribution is named `glossa-lang` (the name `glossa` was already taken on
PyPI); the command it installs is `glossa`.

From a checkout instead:

```bash
cd glossa && python3 -m venv .venv && .venv/bin/pip install -e ".[dev]"
ln -sf "$PWD/.venv/bin/glossa" ~/.local/bin/glossa
```

## Commands

| Command | What it does |
|---|---|
| `glossa -code TEXT` | plain text → language (also `-encode`, `-e`, `encode`) |
| `glossa -decode TEXT` | language → plain text (also `-d`, `decode`) |
| `glossa words list` | show the lexicon: source, invented word, symbols |
| `glossa words add bread tamu` | fix a translation by hand (omit `tamu` to coin one) |
| `glossa words remove bread` | forget one word |
| `glossa learn notes.txt` | count words in files, coin the most common ones |
| `glossa common -n 20` | the most frequent words seen so far |
| `glossa alphabet` | print the letter → symbol table |
| `glossa alphabet regen --yes` | new script (old encoded text becomes unreadable) |
| `glossa config set order rotate` | change the word-order rule |
| `glossa stats` | summary of the language memory |
| `glossa where` | print the memory file paths |
| `glossa reset --yes` | wipe the language and start over |

Text can come from arguments, `-f FILE`, or a pipe:

```bash
cat notes.txt | glossa -code
```

## Word order rules

`glossa config set order <rule>` — every rule is exactly reversible.

- `reverse` (default) — `i eat bread` → `bread eat i`
- `rotate` — last word to the front: `i eat bread` → `bread i eat`
- `pairs` — swap neighbours: `a b c d` → `b a d c`
- `none` — keep the original order

## Memory files

Everything lives in `~/.glossa` (override with `GLOSSA_HOME` or `--home DIR`):

| File | Contents |
|---|---|
| `lexicon.json` | `{"words": {"bread": "tamu"}}` — the word memory |
| `alphabet.json` | `{"seed": "glossa-a1b2c3d4", "map": {"a": "ⵜ"}}` — the script |
| `stats.json` | `{"documents": 3, "counts": {"the": 42}}` — which words are common |
| `config.json` | `{"order": "reverse", "seed": "…", "auto_coin": true}` |

Words are coined deterministically from the seed, so the same seed always
invents the same word for the same source word.

## Notes

- Capitalisation is carried by a mark in front of the word: `◆` = first letter, `◈` = all caps.
- Unknown words come back unchanged on decode, with a warning on stderr.
- `--no-new-words` encodes without inventing anything new.

## Tests

```bash
.venv/bin/python -m pytest --cov --cov-report=term-missing
```
