File size: 1,189 Bytes
24f95f0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""
Verification script for the Phase 2 MMSA-based Dissonance Engine.
"""
import sys
import os

# Add backend to path
sys.path.append(os.path.join(os.getcwd(), "backend"))

def test_mmsa_logic():
    print("--- 🧪 MMSA Engine Verification ---")
    try:
        from app.services.mmsa_engine import mmsa_engine
        
        # Test Case: Sarcasm Simulation
        # Transcript is positive, but audio sentiment is negative (simulated)
        audio_path = "backend/tests/test_probe.wav"
        transcript = "This is just great, absolutely wonderful."
        
        print(f"Analyzing: '{transcript}'")
        result = mmsa_engine.analyze(audio_path, transcript)
        
        print("\nResults:")
        import json
        print(json.dumps(result, indent=2))
        
        # Assertion
        if result.get("is_dissonant"):
            print("\n✅ Success: Engine correctly identified simulated emotional dissonance.")
        else:
            print("\n⚠️ Note: No dissonance detected (expected in this mock run).")
            
    except Exception as e:
        print(f"\n❌ Test Failed: {e}")
        sys.exit(1)

if __name__ == "__main__":
    test_mmsa_logic()