4bbfdcceff
audio-surface.el / image-surface.el: own-core additive-synthesis WAV and
raster-PNG renderers (integer-only DSP, since EL has no floats), rendered
from learned engram signatures via a pluggable surface-profile
abstraction (surface-profile.el). audio-demo.el / image-demo.el are
drivers. NOTE: demo files hardcode absolute paths to this worktree's own
directory — will need a path fixup before landing.
elp/projector/ is a Python package the author's own README marks as
"STAGING/PROOF-OF-SHAPE — not the deliverable", superseded by the native
.el surface-profile work above; kept as a validated architecture proof.
Generated output (elp/faculty/{out,sig}, elp/projector/out,
__pycache__) intentionally excluded.
82 lines
3.2 KiB
Python
82 lines
3.2 KiB
Python
"""generate.py — drive the projector: one geometry region -> many surfaces.
|
|
|
|
Proves the thesis with REAL output: builds ONE surface-neutral DocumentIR from
|
|
Neuron's OWN self-geometry (read-only against the live soul via the proven
|
|
faculty), then EMITS it to Markdown, docx, and MIDI — the same plan/realize/
|
|
cohere, three surfaces. Writes the files + the faithfulness audit to ./out/.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import os
|
|
import sys
|
|
|
|
_HERE = os.path.dirname(os.path.abspath(__file__))
|
|
sys.path.insert(0, _HERE)
|
|
|
|
import pipeline # noqa: E402
|
|
import provenance # noqa: E402
|
|
from geometry import load_self_region # noqa: E402
|
|
|
|
OUT = os.path.join(_HERE, "out")
|
|
|
|
|
|
def _emit_all(doc, stem):
|
|
"""Emit one IR to every text/audio surface + audit + provenance."""
|
|
for surface in ("markdown", "docx", "midi"):
|
|
data = pipeline.emit(doc, surface)
|
|
proj = pipeline.get_projector(surface)
|
|
path = os.path.join(OUT, f"{stem}.{proj.ext}")
|
|
with open(path, "wb") as f:
|
|
f.write(data)
|
|
print(f" emitted {surface:9s} -> {os.path.basename(path)} ({len(data)} bytes)")
|
|
a = provenance.audit(doc)
|
|
with open(os.path.join(OUT, f"{stem}.audit.json"), "w") as f:
|
|
json.dump(a, f, indent=2)
|
|
with open(os.path.join(OUT, f"{stem}.provenance.md"), "w") as f:
|
|
f.write(provenance.trace_table(doc))
|
|
print(" audit:", {k: a[k] for k in ("claims", "ungrounded_claims",
|
|
"negations_preserved", "distinct_source_nodes", "faithful")})
|
|
return a
|
|
|
|
|
|
def main():
|
|
os.makedirs(OUT, exist_ok=True)
|
|
print("surfaces registered:", pipeline.available_surfaces())
|
|
|
|
# ---- Document 1: Neuron's self-description (marquee) ------------------- #
|
|
print("\n[1] Neuron self-description")
|
|
region = load_self_region(max_nodes=9)
|
|
print(" self region:", region)
|
|
doc1 = pipeline.build_ir(
|
|
None, region=region,
|
|
title="Neuron: A Self-Description from Its Own Geometry",
|
|
subtitle="Projected efferently from the engram — every claim traces a node.",
|
|
format_spec={"genre": "self-description", "register": "expository"},
|
|
max_sections=5, conf_floor=0.6)
|
|
print(f" IR: {len(doc1.sections)} sections, {doc1.claim_count()} claims, "
|
|
f"ungrounded={doc1.ungrounded_count()}")
|
|
_emit_all(doc1, "neuron-self")
|
|
|
|
# ---- Document 2: a coherent, clean whitepaper-style section ------------ #
|
|
print("\n[2] Whitepaper-style section (coherent clean region)")
|
|
doc2, _ = pipeline.project(
|
|
["chronoception", "time", "awareness", "engram", "temporal"],
|
|
surface="markdown",
|
|
title="Temporal Awareness in the Engram",
|
|
subtitle="A section projected from the geometry of chronoception.",
|
|
format_spec={"genre": "whitepaper-section", "register": "technical"},
|
|
max_sections=4)
|
|
print(f" IR: {len(doc2.sections)} sections, {doc2.claim_count()} claims, "
|
|
f"ungrounded={doc2.ungrounded_count()}")
|
|
_emit_all(doc2, "engram-temporal")
|
|
|
|
# echo both markdowns so they are visible in the run log
|
|
for stem, doc in (("neuron-self", doc1), ("engram-temporal", doc2)):
|
|
print(f"\n===== GENERATED MARKDOWN — {stem} =====\n")
|
|
print(pipeline.emit(doc, "markdown").decode())
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|