|
| 1 | +#!/usr/bin/env python3 |
| 2 | +""" |
| 3 | +Direct test of the 4 semantic primitives: LOVE, JUSTICE, POWER, WISDOM |
| 4 | +""" |
| 5 | + |
| 6 | +from harmonizer.divine_invitation_engine_V2 import ( |
| 7 | + DivineInvitationSemanticEngine, |
| 8 | + Coordinates, |
| 9 | + Dimension, |
| 10 | +) |
| 11 | + |
| 12 | + |
| 13 | +def test_primitives(): |
| 14 | + """Test each primitive dimension directly""" |
| 15 | + engine = DivineInvitationSemanticEngine() |
| 16 | + |
| 17 | + print("=" * 70) |
| 18 | + print("TESTING 4 SEMANTIC PRIMITIVES") |
| 19 | + print("=" * 70) |
| 20 | + |
| 21 | + # Test 1: LOVE primitive |
| 22 | + print("\n1. LOVE PRIMITIVE") |
| 23 | + love_result = engine.analyze_text("love compassion kindness care") |
| 24 | + print(f" Text: 'love compassion kindness care'") |
| 25 | + print(f" Coordinates: {love_result.coordinates}") |
| 26 | + print(f" LOVE value: {love_result.coordinates.love:.3f}") |
| 27 | + assert love_result.coordinates.love > 0.8, "LOVE dimension should be dominant" |
| 28 | + print(" ✓ LOVE primitive working correctly") |
| 29 | + |
| 30 | + # Test 2: JUSTICE primitive |
| 31 | + print("\n2. JUSTICE PRIMITIVE") |
| 32 | + justice_result = engine.analyze_text("justice truth fairness law order") |
| 33 | + print(f" Text: 'justice truth fairness law order'") |
| 34 | + print(f" Coordinates: {justice_result.coordinates}") |
| 35 | + print(f" JUSTICE value: {justice_result.coordinates.justice:.3f}") |
| 36 | + assert justice_result.coordinates.justice > 0.8, "JUSTICE dimension should be dominant" |
| 37 | + print(" ✓ JUSTICE primitive working correctly") |
| 38 | + |
| 39 | + # Test 3: POWER primitive |
| 40 | + print("\n3. POWER PRIMITIVE") |
| 41 | + power_result = engine.analyze_text("power strength action control execute") |
| 42 | + print(f" Text: 'power strength action control execute'") |
| 43 | + print(f" Coordinates: {power_result.coordinates}") |
| 44 | + print(f" POWER value: {power_result.coordinates.power:.3f}") |
| 45 | + assert power_result.coordinates.power > 0.8, "POWER dimension should be dominant" |
| 46 | + print(" ✓ POWER primitive working correctly") |
| 47 | + |
| 48 | + # Test 4: WISDOM primitive |
| 49 | + print("\n4. WISDOM PRIMITIVE") |
| 50 | + wisdom_result = engine.analyze_text("wisdom knowledge understanding analysis") |
| 51 | + print(f" Text: 'wisdom knowledge understanding analysis'") |
| 52 | + print(f" Coordinates: {wisdom_result.coordinates}") |
| 53 | + print(f" WISDOM value: {wisdom_result.coordinates.wisdom:.3f}") |
| 54 | + assert wisdom_result.coordinates.wisdom > 0.8, "WISDOM dimension should be dominant" |
| 55 | + print(" ✓ WISDOM primitive working correctly") |
| 56 | + |
| 57 | + # Test 5: Mixed coordinates |
| 58 | + print("\n5. MIXED COORDINATES") |
| 59 | + mixed_result = engine.analyze_text("love justice power wisdom") |
| 60 | + print(f" Text: 'love justice power wisdom'") |
| 61 | + print(f" Coordinates: {mixed_result.coordinates}") |
| 62 | + print(f" L={mixed_result.coordinates.love:.3f}, ", end="") |
| 63 | + print(f"J={mixed_result.coordinates.justice:.3f}, ", end="") |
| 64 | + print(f"P={mixed_result.coordinates.power:.3f}, ", end="") |
| 65 | + print(f"W={mixed_result.coordinates.wisdom:.3f}") |
| 66 | + expected = 0.25 |
| 67 | + tolerance = 0.01 |
| 68 | + assert abs(mixed_result.coordinates.love - expected) < tolerance |
| 69 | + assert abs(mixed_result.coordinates.justice - expected) < tolerance |
| 70 | + assert abs(mixed_result.coordinates.power - expected) < tolerance |
| 71 | + assert abs(mixed_result.coordinates.wisdom - expected) < tolerance |
| 72 | + print(" ✓ All primitives balanced at 0.25 each") |
| 73 | + |
| 74 | + # Test 6: Verify Dimension enum |
| 75 | + print("\n6. DIMENSION ENUM") |
| 76 | + print(f" LOVE = {Dimension.LOVE.value}") |
| 77 | + print(f" JUSTICE = {Dimension.JUSTICE.value}") |
| 78 | + print(f" POWER = {Dimension.POWER.value}") |
| 79 | + print(f" WISDOM = {Dimension.WISDOM.value}") |
| 80 | + assert Dimension.LOVE.value == "love" |
| 81 | + assert Dimension.JUSTICE.value == "justice" |
| 82 | + assert Dimension.POWER.value == "power" |
| 83 | + assert Dimension.WISDOM.value == "wisdom" |
| 84 | + print(" ✓ All enum values correct") |
| 85 | + |
| 86 | + # Test 7: Coordinates dataclass |
| 87 | + print("\n7. COORDINATES DATACLASS") |
| 88 | + test_coords = Coordinates(love=0.1, justice=0.2, power=0.3, wisdom=0.4) |
| 89 | + print(f" Created: {test_coords}") |
| 90 | + assert test_coords.love == 0.1 |
| 91 | + assert test_coords.justice == 0.2 |
| 92 | + assert test_coords.power == 0.3 |
| 93 | + assert test_coords.wisdom == 0.4 |
| 94 | + print(" ✓ Coordinates structure working") |
| 95 | + |
| 96 | + print("\n" + "=" * 70) |
| 97 | + print("ALL 4 SEMANTIC PRIMITIVES VERIFIED AND WORKING") |
| 98 | + print("=" * 70) |
| 99 | + print("\nResult: LOVE, JUSTICE, POWER, WISDOM are functioning correctly") |
| 100 | + print("in the semantic coordinate system.\n") |
| 101 | + |
| 102 | + |
| 103 | +if __name__ == "__main__": |
| 104 | + test_primitives() |
0 commit comments