personabot-api / tests /test_transcriber_normalization.py
GitHub Actions
Deploy 92e36db
4a9ec15
import re
from app.core.config import get_settings
from app.services.transcriber import _normalise_transcript_text
def _get_test_replacements():
replacements = get_settings().TRANSCRIBE_REPLACEMENTS
return tuple(
(re.compile(pattern, re.IGNORECASE), replacement)
for pattern, replacement in replacements.items()
)
def test_normalise_walk_experience_to_work_experience() -> None:
query = "uh what is his walk experience in a professional setting"
replacements = _get_test_replacements()
assert _normalise_transcript_text(query, replacements) == "what is his work experience in a professional setting"
def test_normalise_text_stack_to_tech_stack() -> None:
replacements = _get_test_replacements()
assert _normalise_transcript_text("what text stack does he use", replacements) == "what tech stack does he use"
def test_keeps_clean_transcript_unchanged() -> None:
original = "What technologies and skills does he work with?"
replacements = _get_test_replacements()
assert _normalise_transcript_text(original, replacements) == original