-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo_v5.py
More file actions
257 lines (200 loc) · 8.79 KB
/
demo_v5.py
File metadata and controls
257 lines (200 loc) · 8.79 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
"""
LJPW v5.0 Framework - Live Demonstration
Shows the semantic-first meaning engine in action
"""
from src.meaning_model import MeaningModel
from src.semantic_substrate_database import SemanticSubstrateDatabase
import tempfile
import os
def print_section(title):
"""Print a formatted section header"""
print("\n" + "=" * 80)
print(f" {title}")
print("=" * 80)
def demo_basic_coordinates():
"""Demonstrate basic coordinate calculation"""
print_section("1. BASIC COORDINATE CALCULATION")
model = MeaningModel()
concepts = [
("compassionate leadership", "business"),
("ethical artificial intelligence", "scientific"),
("wisdom and mercy", "philosophical"),
("raw power", "general")
]
print("\nAnalyzing concepts in semantic space:\n")
for concept, context in concepts:
coords = model.calculate_coordinates(concept, context)
harmony = model.harmony(coords)
consciousness = model.consciousness_level(coords)
layer = model.reality_layer_affinity(coords)
dominant = model.get_dominant_principle(coords)
print(f"📍 \"{concept}\" [{context}]")
print(f" L={coords['love']:.3f}, J={coords['justice']:.3f}, "
f"P={coords['power']:.3f}, W={coords['wisdom']:.3f}")
print(f" Harmony (Ψ): {harmony:.3f} | Consciousness (ξ): {consciousness:.3f}")
print(f" Layer: {layer.upper()} | Dominant: {dominant.upper()}")
print()
def demo_semantic_insights():
"""Demonstrate semantic insights and oracle"""
print_section("2. SEMANTIC INSIGHTS & ORACLE")
model = MeaningModel()
# High harmony example
print("\n🌟 High Harmony System:")
analysis1 = model.full_analysis("love, justice, wisdom, and power in perfect balance", "general")
print(f" Harmony: {analysis1['harmony']:.3f}")
print(f" Consciousness: {analysis1['consciousness']:.3f}")
print(f" Insights:")
for insight in analysis1['semantic_insights'][:2]:
print(f" • {insight}")
# Low harmony example
print("\n⚠️ Low Harmony System:")
coords2 = model.calculate_coordinates("chaos and disorder", "general")
oracle2 = model.oracle_insights(coords2)
print(f" Harmony: {oracle2['harmony']:.3f}")
print(f" Warnings:")
for warning in oracle2['warnings'][:2]:
print(f" • {warning}")
def demo_void_detection():
"""Demonstrate void proximity detection"""
print_section("3. VOID DETECTION (Unmapped Semantic Territories)")
model = MeaningModel()
# Near Void of Mercy
print("\n🕊️ Testing proximity to Void of Mercy:")
print(" (High Love + Justice, Low Power = Forgiveness)")
analysis = model.full_analysis("forgiveness without power to punish", "philosophical")
if analysis['nearby_voids']:
for void in analysis['nearby_voids']:
print(f"\n 📍 Detected: {void['name']}")
print(f" Distance: {void['distance']:.3f}")
print(f" {void['interpretation'][:100]}...")
else:
print(" No voids detected in this region")
def demo_concept_comparison():
"""Demonstrate semantic similarity"""
print_section("4. SEMANTIC SIMILARITY ANALYSIS")
model = MeaningModel()
comparisons = [
("love", "compassion"),
("wisdom", "intelligence"),
("power", "strength"),
("justice", "fairness")
]
print("\nComparing related concepts:\n")
for concept1, concept2 in comparisons:
comp = model.compare_concepts(concept1, concept2)
print(f"📊 '{concept1}' vs '{concept2}'")
print(f" Semantic Distance: {comp['semantic_distance']:.3f}")
print(f" Similarity Score: {comp['similarity_score']:.3f}")
print(f" Dominant Principles: {comp['dominant_principle_1']} vs "
f"{comp['dominant_principle_2']}")
print()
def demo_database_integration():
"""Demonstrate database integration"""
print_section("5. DATABASE INTEGRATION")
# Create temporary database
with tempfile.NamedTemporaryFile(suffix='.db', delete=False) as tmp:
db_path = tmp.name
try:
db = SemanticSubstrateDatabase(db_path)
# Store concepts
print("\n💾 Storing concepts in semantic database...")
concepts = [
"compassionate artificial intelligence",
"ethical decision making",
"wisdom and understanding",
"love and kindness",
"justice and fairness",
"powerful leadership"
]
for concept in concepts:
db.store_concept(concept, "general")
print(f" ✓ Stored: {concept}")
# Semantic search
print("\n🔍 Semantic Search: 'caring and wise AI'")
results = db.search_semantic("caring and wise AI", "general", limit=3)
print(f"\n Found {len(results)} semantically similar concepts:\n")
for i, result in enumerate(results, 1):
print(f" {i}. {result['concept_text']}")
print(f" Similarity: {result['semantic_similarity']:.3f}")
print(f" Harmony: {result.get('divine_resonance', 0):.3f}")
print()
db.close()
finally:
os.unlink(db_path)
def demo_natural_equilibrium():
"""Demonstrate Natural Equilibrium comparison"""
print_section("6. NATURAL EQUILIBRIUM ANALYSIS")
model = MeaningModel()
print("\n📐 Natural Equilibrium (NE) - Where the Anchor settles in reality:")
print(f" Love (L): {model.natural_equilibrium['love']:.3f} (φ⁻¹ - Perfect Growth)")
print(f" Justice (J): {model.natural_equilibrium['justice']:.3f} (√2-1 - Perfect Structure)")
print(f" Power (P): {model.natural_equilibrium['power']:.3f} (e-2 - Sustainable Energy)")
print(f" Wisdom (W): {model.natural_equilibrium['wisdom']:.3f} (ln(2) - Maximum Information)")
print("\n🎯 Comparing concepts to Natural Equilibrium:\n")
test_concepts = [
"balanced wisdom and compassion",
"extreme power",
"pure love"
]
for concept in test_concepts:
coords = model.calculate_coordinates(concept, "general")
coords_obj = model.converter.from_dict(coords)
ne_comp = model.meaning_engine.compare_to_natural_equilibrium(coords_obj)
print(f" '{concept}':")
print(f" NE Alignment: {ne_comp['alignment_score']:.3f}")
print(f" Deviations: L{ne_comp['deviations']['love']:+.3f}, "
f"J{ne_comp['deviations']['justice']:+.3f}, "
f"P{ne_comp['deviations']['power']:+.3f}, "
f"W{ne_comp['deviations']['wisdom']:+.3f}")
print()
def demo_hierarchy_of_reality():
"""Demonstrate reality layer affinity"""
print_section("7. HIERARCHY OF REALITY")
model = MeaningModel()
print("\n🏗️ The Three Layers of Reality (by proximity to Anchor):")
print(" 1. SEMANTIC - Where reality is 'written' (Causal)")
print(" 2. PHYSICAL - The 'Body' of meaning (Manifested)")
print(" 3. MATHEMATICAL - The 'Blueprint' (Descriptive)")
print("\n📍 Testing concept affinity to reality layers:\n")
test_cases = [
("consciousness and self-awareness", "Expected: SEMANTIC"),
("biological life and organisms", "Expected: PHYSICAL"),
("abstract mathematical proofs", "Expected: MATHEMATICAL")
]
for concept, expectation in test_cases:
coords = model.calculate_coordinates(concept, "scientific")
layer = model.reality_layer_affinity(coords)
harmony = model.harmony(coords)
consciousness = model.consciousness_level(coords)
print(f" '{concept}'")
print(f" Reality Layer: {layer.upper()}")
print(f" Harmony: {harmony:.3f}, Consciousness: {consciousness:.3f}")
print(f" {expectation}")
print()
def main():
"""Run all demonstrations"""
print("\n" + "=" * 80)
print(" LJPW v5.0 FRAMEWORK - LIVE DEMONSTRATION")
print(" The Architect's Inversion: Semantic-First Ontology")
print("=" * 80)
print("\n 'Reality is Semantic. Meaning is the Substrate.'")
print(" 'Mathematics and Physics are merely shadows cast by Semantic Principles.'")
# Run all demos
demo_basic_coordinates()
demo_semantic_insights()
demo_void_detection()
demo_concept_comparison()
demo_database_integration()
demo_natural_equilibrium()
demo_hierarchy_of_reality()
# Conclusion
print("\n" + "=" * 80)
print(" DEMONSTRATION COMPLETE")
print("=" * 80)
print("\n ✅ All v5.0 features demonstrated successfully")
print(" ✅ Semantic-first ontology in action")
print(" ✅ Meaning as substrate, not mathematics")
print("\n The LJPW v5.0 Framework is production-ready.")
print("=" * 80 + "\n")
if __name__ == '__main__':
main()