Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions stackvox/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,15 @@ def apply_pronunciations(text: str, mapping: dict[str, str] | None) -> str:
"cli": "C L I",
"ci": "C I",
"ide": "I D E",
"aws": "A W S",
"aws": "A.W.S.", # dotted: espeak reads a lone "A" as the article "uh"; dots force the letter name "ay"
"uri": "U R I",
"iam": "I A M",
"iam": "I.A.M.", # ditto — the middle "A" needs the dot
"saas": "sass",
"paas": "pass",
"tui": "T U I",
"postgresql": "postgres",
"kubectl": "kube control",
"stackone": "stack one", # org name espeak garbles as "stac kone"
}


Expand Down
8 changes: 7 additions & 1 deletion tests/test_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,17 @@ def test_plain_text_mode_splits_paragraphs():
def test_dev_acronyms_are_spelled_out():
assert normalize_for_speech("Use the CLI.", markdown=False) == "Use the C L I."
assert "C L I" in normalize_for_speech("the cli tool", markdown=False) # lowercase too
assert "A W S" in normalize_for_speech("deploy to AWS", markdown=False)
assert "A.W.S." in normalize_for_speech("deploy to AWS", markdown=False) # dotted → "ay"
assert "I.A.M." in normalize_for_speech("set up IAM", markdown=False)
assert "U R I" in normalize_for_speech("parse the URI", markdown=False)
assert "C I C D" in normalize_for_speech("the CI/CD pipeline", markdown=False)


def test_org_names_are_spoken_word_by_word():
assert "stack one" in normalize_for_speech("deployed to StackOne today", markdown=False)
assert "stack one" in normalize_for_speech("the stackone api", markdown=False) # case-insensitive


def test_dev_terms_leave_correctly_voiced_acronyms_alone():
out = normalize_for_speech("Send JSON over HTTP to the API.", markdown=False)
assert "JSON" in out
Expand Down
Loading