core/language_packs/__init__.py
Shay 09c3664773
Fix CLI help/runtime imports and add doctor command (#4)
* Make core CLI help robust and intuitive

* Package runtime support modules for core CLI

* Add CLI help and doctor tests

* Fix CLI trace help and pack listing

* Export language pack listing helper

* Bootstrap repo root for console runtime imports

* Align trace formatter with Proposition schema

* Cover real trace payload formatting
2026-05-13 21:15:51 -07:00

74 lines
1.8 KiB
Python

"""
language_packs — compiled linguistic manifold schemas.
Language packs are not datasets. They are pinned, checksummed, compiled
linguistic manifolds: surface forms, morphology, grammar attractors,
cross-language resonances, and holonomy resonance proofs.
"""
from pathlib import Path
from .schema import (
AlignmentEdge,
GrammarAttractor,
HolonomyAlignmentCase,
LanguagePackManifest,
LanguageRole,
LexicalEntry,
MorphologyEntry,
OOVPolicy,
)
_DATA_DIR = Path(__file__).parent / "data"
def list_packs() -> list[str]:
"""Return available compiled language-pack ids."""
if not _DATA_DIR.exists():
return []
return sorted(
path.name
for path in _DATA_DIR.iterdir()
if path.is_dir()
and (path / "manifest.json").exists()
and (path / "lexicon.jsonl").exists()
)
__all__ = [
"AlignmentEdge",
"GrammarAttractor",
"HolonomyAlignmentCase",
"LanguagePackManifest",
"LanguageRole",
"LexicalEntry",
"MorphologyEntry",
"OOVPolicy",
"list_packs",
]
def __getattr__(name: str):
if name in {
"compile_entries_to_manifold",
"compile_entries_to_modality_vocab",
"load_mounted_packs",
"load_pack",
"load_pack_entries",
}:
from .compiler import (
compile_entries_to_manifold,
compile_entries_to_modality_vocab,
load_mounted_packs,
load_pack,
load_pack_entries,
)
return {
"compile_entries_to_manifold": compile_entries_to_manifold,
"compile_entries_to_modality_vocab": compile_entries_to_modality_vocab,
"load_mounted_packs": load_mounted_packs,
"load_pack": load_pack,
"load_pack_entries": load_pack_entries,
}[name]
raise AttributeError(name)