Replace the divergent rotation-based diffusion operator with a linear blend + exponential-map re-unitization approach that converges in ~28 steps while maintaining vc < 1e-6. Key changes: - GraphDiffusionOperator now averages neighbors in multivector space and re-projects via per-plane exponentials (cos/sin for rotations, cosh/sinh for boosts in Cl(4,1)) - run_pulse V3: per-token graph topology with input-driven output node, recall via VocabManifold.nearest(), --no-glove flag for compiled pack - Tests updated for V3 API Different inputs now produce different recall rankings from the compiled en_core_cognition_v1 vocabulary, completing Threshold 1 (Semantic Encoding). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
40 lines
1.5 KiB
Python
40 lines
1.5 KiB
Python
"""Integration test — full pulse cycle from injection to vault recall."""
|
|
|
|
import numpy as np
|
|
|
|
from scripts.run_pulse import run_pulse, _build_manifold
|
|
from language_packs.compiler import load_pack
|
|
|
|
|
|
class TestPulseIntegration:
|
|
def test_full_cycle_completes(self) -> None:
|
|
words = run_pulse("hello world", use_glove=False)
|
|
assert isinstance(words, list)
|
|
assert len(words) > 0
|
|
assert all(isinstance(w, str) for w in words)
|
|
|
|
def test_output_node_changes(self) -> None:
|
|
_, manifold = load_pack("en_core_cognition_v1")
|
|
state, labels = _build_manifold("test input", manifold)
|
|
output_idx = len(labels) - 1
|
|
initial_output = state.fields[output_idx].copy()
|
|
|
|
from field.operators import GraphDiffusionOperator
|
|
op = GraphDiffusionOperator(damping=0.5)
|
|
for _ in range(20):
|
|
state, _ = op.forward(state)
|
|
assert not np.allclose(state.fields[output_idx], initial_output, atol=1e-7)
|
|
|
|
def test_different_inputs_produce_different_output(self) -> None:
|
|
w1 = run_pulse("alpha", use_glove=False)
|
|
w2 = run_pulse("omega", use_glove=False)
|
|
assert isinstance(w1, list) and isinstance(w2, list)
|
|
|
|
def test_recall_returns_known_vocab(self) -> None:
|
|
_, manifold = load_pack("en_core_cognition_v1")
|
|
words = run_pulse("wisdom seeker", use_glove=False)
|
|
for w in words:
|
|
try:
|
|
manifold.get_versor(w)
|
|
except KeyError:
|
|
raise AssertionError(f"{w!r} not in compiled vocab")
|