File size: 2,440 Bytes
aa2c910
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""
Verification script for the enhanced pronunciation assessment system
"""

def verify_enhanced_features():
    """Verify that the enhanced features are properly implemented"""
    print("Verifying enhanced pronunciation assessment system...")
    
    # Import the enhanced classes
    try:
        from src.apis.controllers.speaking_controller import (
            EnhancedPronunciationAssessor,
            SimplePronunciationAssessor
        )
        print("βœ“ Enhanced classes imported successfully")
    except ImportError as e:
        print(f"βœ— Failed to import enhanced classes: {e}")
        return False
    
    # Test EnhancedPronunciationAssessor initialization
    try:
        enhanced_assessor = EnhancedPronunciationAssessor()
        print("βœ“ EnhancedPronunciationAssessor initialized successfully")
    except Exception as e:
        print(f"βœ— Failed to initialize EnhancedPronunciationAssessor: {e}")
        return False
    
    # Test SimplePronunciationAssessor (backward compatibility)
    try:
        simple_assessor = SimplePronunciationAssessor()
        print("βœ“ SimplePronunciationAssessor (backward compatibility) initialized successfully")
    except Exception as e:
        print(f"βœ— Failed to initialize SimplePronunciationAssessor: {e}")
        return False
    
    # Test method availability
    expected_methods = [
        'assess_pronunciation',
        '_enhanced_phoneme_comparison',
        '_analyze_prosody',
        '_create_phoneme_pairs',
        '_create_phoneme_comparison_summary'
    ]
    
    for method in expected_methods:
        if hasattr(enhanced_assessor, method):
            print(f"βœ“ Method {method} available")
        else:
            print(f"βœ— Method {method} missing")
            return False
    
    # Test G2P enhancements
    try:
        from src.apis.controllers.speaking_controller import SimpleG2P
        g2p = SimpleG2P()
        if hasattr(g2p, 'get_visualization_data'):
            print("βœ“ G2P visualization data method available")
        else:
            print("βœ— G2P visualization data method missing")
            return False
    except Exception as e:
        print(f"βœ— Failed to test G2P enhancements: {e}")
        return False
    
    print("\nAll verification tests passed! The enhanced pronunciation system is ready.")
    return True

if __name__ == "__main__":
    verify_enhanced_features()