Run_code_api / verify_enhanced_system.py
ABAO77's picture
Implement enhanced pronunciation assessment system with Wav2Vec2 support
aa2c910
raw
history blame
2.44 kB
#!/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()