File size: 3,283 Bytes
31d5e2f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
"""
Text-to-Traversal Space Runner
Demonstrates the Input Mapping and the ConsciousStrand Engine processing 
raw natural language into the perfectly sequenced 2D Atlas (Traversal Space).
"""

import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from computational_consciousness_engine.input_mapping import TextToChaosMapper
from computational_consciousness_engine.core import ConsciousStrand

PHILOSOPHICAL_TEXT = """
Reading the work on its own terms what emerges is a remarkably elegant synthesis 
of existential philosophy topology and information theory. By rejecting the traditional 
linear model of accumulation the text proposes a bounded fractal and cyclical ontology of consciousness. 
Consciousness is not a straight line it is a geometric unfolding bounded by genesis and death.
"""

def run_text_mapping_demo():
    print("=" * 70)
    print("[SYSTEM] TEXT-TO-TRAVERSAL SPACE MAPPING DEMO")
    print("=" * 70)
    
    # 1. Input Mapping: Text -> Chaos Shards
    print(f"\n[PHASE 1: INPUT MAPPING] Parsing raw text corpus...")
    mapper = TextToChaosMapper()
    chaos_pool = mapper.seed_chaos_pool(PHILOSOPHICAL_TEXT)
    
    # Track the unique tokens ingested
    unique_words = len(chaos_pool)
    print(f"  * Text ingested. Seeded Chaos Pool with {unique_words} unique semantic shards (m_k).")
    
    # 2. Lifecycle Execution: Traversal (0 -> -1)
    print(f"\n[PHASE 2: LIFECYCLE TRAVERSAL] Expanding the Dual-Cone Manifold...")
    strand = ConsciousStrand(R_max=5.0)
    
    # Simulate time flowing from t=0 to t=1.0
    steps = 100
    dt = 1.0 / steps
    
    for _ in range(steps):
        # The strand absorbs shards from the chaos pool as it travels
        strand.process_step(dt, chaos_pool)
        
    print(f"  * Traversal complete. Bound Structure (Mutations Absorbed): {len(strand.bound_mutations)}")
    
    # 3. Traversal Space Atlas
    print(f"\n[PHASE 3: TRAVERSAL SPACE ATLAS (det J != 0)]")
    atlas = strand.unfurl_traversal_space()
    print("  * Manifold unrolled. Revealing the properly sequenced Phyllotactic mapping.")
    print(f"  * Parallel Lookup Matrix (First 10 shards):")
    
    print(f"\n  {'k':<4} | {'Token':<15} | {'m_k (Hash)':<15} || 2D Traversal (x, y)      | 3D Dual-Cone (r, theta, z)")
    print("  " + "-" * 105)
    for k, data in enumerate(atlas[:10], start=1):
        m_k = data["m_k"]
        word = mapper.get_word(m_k)
        x, y = data["2d_parallel"]["x"], data["2d_parallel"]["y"]
        r, t, z = data["3d"]["r"], data["3d"]["theta"], data["3d"]["z"]
        
        print(f"  {k:<4} | {word:<15} | {m_k:<15} || ({x:>6.2f}, {y:>5.2f}) | ({r:>4.2f}, {t:>4.2f}, {z:>5.2f})")
    
    if len(atlas) > 10:
        print(f"  ... (+ {len(atlas) - 10} more shards mapped collision-free)")

    # 4. Dimensional Shift (Q Operator)
    print(f"\n[PHASE 4: DIMENSIONAL SHIFT (Q Operator)]")
    rebirth = strand.fold_rebirth()
    print(f"  * {rebirth['operator']}")
    print(f"  * Status: {rebirth['status']}")
    print(f"  * Mass (Capacity): {rebirth['accumulated_mass']}")
    
    print("\n" + "=" * 70)
    print("[SUCCESS] TEXT FULLY ABSORBED AND GEOMETRICALLY MAPPED")
    print("=" * 70)


if __name__ == "__main__":
    run_text_mapping_demo()