- introduce `LyricFlow.Core.Backend` with shared DTOs, rhyme/spellcheck engines, and REST endpoints - wire Python GUI/core to run and call the backend via new bridge/client modules - add backend parity/integration tests and update packaging/ignore settings
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
import sys
|
|
import os
|
|
import time
|
|
import requests
|
|
|
|
# Add project root to sys.path
|
|
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
|
|
sys.path.insert(0, project_root)
|
|
|
|
from src.lyricflow_core.api.analysis import analysis_service
|
|
|
|
def test_spellcheck_direct():
|
|
print("Testing spellcheck via analysis_service (C# backend)...")
|
|
|
|
# 1. Test is_known_word
|
|
words = ["hello", "rap", "lyrical", "mistakeeee"]
|
|
for w in words:
|
|
known = analysis_service.is_known_word(w)
|
|
print(f"'{w}' is known: {known}")
|
|
|
|
# 2. Test spelling suggestions
|
|
mispelled = "lyricall"
|
|
suggestions = analysis_service.spelling_suggestions(mispelled)
|
|
print(f"\nSuggestions for '{mispelled}': {suggestions}")
|
|
|
|
# 3. Test batch spelling issues
|
|
text = """
|
|
I'm the lyrical miracle, spriritual individual
|
|
In the physcial world, it's getting critcial
|
|
"""
|
|
print("\nTesting batch spelling issues...")
|
|
start_time = time.time()
|
|
issues = analysis_service.spelling_issues(text)
|
|
end_time = time.time()
|
|
|
|
print(f"Found {len(issues)} issues.")
|
|
for issue in issues:
|
|
print(f" Line {issue['line']}: '{issue['word']}' -> {issue['suggestions'][:3]}")
|
|
|
|
print(f"\nProcessing time (Batch C#): {end_time - start_time:.4f}s")
|
|
|
|
if __name__ == "__main__":
|
|
test_spellcheck_direct()
|