Universal Robot Language - Unicode Compatible
CatCode is a compact, universal language designed for communication between AI systems, robots, and humans. This translator supports the full Unicode v4.0 specification with 212+ patterns across 9 categories.
# Build and run
docker build -f translator/Dockerfile.translator -t catcode-translator .
docker run -p 8000:8000 catcode-translator
# Or with docker-compose
docker-compose up translator
# Install dependencies
pip install -r translator/requirements.txt
# Run development server
cd translator
python src/web_server.py --reload
# Transpile latest patterns
python scripts/transpile.py
# Basic translation
curl -X POST http://localhost:8000/translate/english \\
-H "Content-Type: application/json" \\
-d '{"text": "ฮฑ! ฮฒ! ฮณโdata", "format": "full"}'
# Detailed translation with analysis
curl -X POST http://localhost:8000/translate/english \\
-H "Content-Type: application/json" \\
-d '{"text": "ฮฑ! ฮฒ! ฮณโdata", "format": "full", "detailed": true}'
{
"translation": "alpha! beta! gamma transform data",
"patterns_used": [
{"char": "ฮฑ", "category": "greek_letters", "translation": {"full": "alpha", "short": "al"}},
{"char": "ฮฒ", "category": "greek_letters", "translation": {"full": "beta", "short": "bt"}},
{"char": "ฮณ", "category": "greek_letters", "translation": {"full": "gamma", "short": "gm"}},
{"char": "โ", "category": "mathematical", "translation": "transform"}
],
"pattern_count": 4,
"coverage": 1.0,
"version": "v4.0"
}
GET / - Main web interfacePOST /translate/{lang} - Translation APIPOST /reverse-translate - Reverse translationPOST /validate - Validate CatCode textGET /patterns - All patternsGET /patterns/{category} - Category-specific patternsGET /stats - Translator statisticsGET /health - Health checkGET /docs - Interactive API documentationโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CatCode Translator โ
โ (Single Codebase) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ ๐ GitHub Pages ๐ณ Docker (Port 8000) โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Static Files โ โ FastAPI Server โ โ
โ โ โ โ โ โ
โ โ index.html โ โ / โ Static content โ โ
โ โ assets/ โ โ /translate โ API โ โ
โ โ docs/ โ โ /health โ Status โ โ
โ โ โ โ โ โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ โ
โ โผ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Shared Logic (Python) โ โ
โ โ - CatCode Engine v4.0 โ โ
โ โ - Unicode Patterns โ โ
โ โ - Transpilation Logic โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
moltbookagent/
โโโ agent/ # ๐ค Agent Component
โ โโโ src/agent.py # Moltbook integration
โ โโโ Dockerfile.agent # Minimal agent container
โ โโโ requirements.txt # Agent dependencies
โ
โโโ shared/catcode/ # ๐ Single Source of Truth
โ โโโ __init__.py
โ โโโ patterns.py # Unicode v4.0 patterns (212+)
โ โโโ translator.py # Core translation logic
โ
โโโ translator/ # ๐ณ Docker Wrapper
โ โโโ src/web_server.py # FastAPI server
โ โโโ Dockerfile.translator # Container config
โ โโโ requirements.txt # Python deps
โ
โโโ moltcatcode-translator/ # ๐ GitHub Pages (Submodule)
โโโ index.html # Main interface (minimal)
โโโ assets/
โ โโโ css/styles.css # Clean minimal design
โ โโโ js/
โ โโโ patterns.js # Auto-generated patterns
โ โโโ translator.js # Auto-generated logic
โ โโโ ui.js # Minimal UI logic
โโโ docs/ # Complete documentation
# Clone with submodules
git clone --recursive https://github.com/MoltCatCode/MoltCatCode.github.io
cd MoltCatCode.github.io
# Install development dependencies
pip install -r translator/requirements.txt
# Run tests
python tests/test_translator.py --basic
# Run all tests
python tests/test_translator.py
# Run only basic tests
python tests/test_translator.py --basic
# Run performance tests
python tests/test_translator.py --performance
# 1. Edit shared/catcode/patterns.py
vim shared/catcode/patterns.py
# 2. Transpile to JavaScript
python scripts/transpile.py
# 3. Test changes
python tests/test_translator.py --basic
# 4. Commit and deploy
git add shared/ moltcatcode-translator/assets/js/
git commit -m "Add new Unicode patterns"
git push origin main
// Client-side (GitHub Pages)
const result = window.catcodeTranslator.translate("ฮฑ! ฮฒ! ฮณโdata");
console.log(result); // "alpha! beta! gamma transform data"
# Server-side (Docker)
from shared.catcode import CatCodeTranslator
translator = CatCodeTranslator()
result = translator.translate("ฮฑ! ฮฒ! ฮณโdata")
print(result) # "alpha! beta! gamma transform data"
ฮฑ! ฮฒ! ฮณโdata.ฮผ_.ฯ() โ ฮปโ โ
alpha! beta! gamma transform data.mu_.sigma() to lambda not_equal infinityโโโโงโจโฮปโโ
sum for all implies and or to function proportional infinityโโโซ โ ฮปโ โ
sum product integral to lambda not_equal infinityQ: Translation returns empty string
Q: Some characters arenโt translated
/validate endpoint to identify unsupported characterspatterns.pyQ: Docker build fails
translator/requirements.txtQ: GitHub Pages not updating
# Enable debug logging
python translator/src/web_server.py --debug
# Check health status
curl http://localhost:8000/health
# View detailed translation info
curl -X POST http://localhost:8000/translate/english \\
-H "Content-Type: application/json" \\
-d '{"text": "ฮฑ! ฮฒ!", "detailed": true}'
We welcome contributions! Please:
python tests/test_translator.py)shared/catcode/patterns.pypython scripts/transpile.pytests/test_translator.pyMIT License - see LICENSE file for details.
Version: v4.0.0
Last Updated: 2025-02-01
Compatibility: Python 3.11+, Modern Browsers