egumasa's picture
Japanese language support
dbc9105
"""
Basic test script to validate the application components.
"""
import sys
import os
# Add the parent directory to the Python path for imports
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
def test_imports():
"""Test that all required modules can be imported."""
try:
from text_analyzer.lexical_sophistication import LexicalSophisticationAnalyzer
from text_analyzer.pos_parser import POSParser
print("βœ“ Backend modules imported successfully")
return True
except ImportError as e:
print(f"βœ— Import error: {e}")
return False
def test_basic_functionality():
"""Test basic functionality with SpaCy models."""
try:
from text_analyzer.lexical_sophistication import LexicalSophisticationAnalyzer
from text_analyzer.pos_parser import POSParser
print("Testing basic class instantiation...")
print("Note: This will fail without SpaCy models installed")
# This is expected to fail without models
try:
analyzer = LexicalSophisticationAnalyzer()
print("βœ“ LexicalSophisticationAnalyzer created")
except Exception as e:
print(f"βœ— LexicalSophisticationAnalyzer failed: {e}")
try:
parser = POSParser()
print("βœ“ POSParser created")
except Exception as e:
print(f"βœ— POSParser failed: {e}")
return True
except Exception as e:
print(f"βœ— Basic functionality test failed: {e}")
return False
def main():
"""Run all tests."""
print("Running basic application tests...")
print("=" * 50)
# Test imports
if not test_imports():
return False
# Test basic functionality
test_basic_functionality()
print("=" * 50)
print("Tests completed. Install SpaCy models to run full functionality.")
print("To install models, run:")
print("pip install -r requirements.txt")
return True
if __name__ == "__main__":
main()