feat: Implement apostrophe normalization settings and overrides in the UI and backend

This commit is contained in:
JB
2025-10-30 06:25:08 -07:00
parent 963ef71647
commit e7f6f0221d
9 changed files with 188 additions and 0 deletions
+1
View File
@@ -31,6 +31,7 @@ def _make_pending_job() -> PendingJob:
max_subtitle_words=50,
metadata_tags={},
chapters=[],
normalization_overrides={},
created_at=0.0,
read_title_intro=False,
normalize_chapter_opening_caps=True,
+25
View File
@@ -78,3 +78,28 @@ def test_numeric_ranges_are_spoken_with_to() -> None:
def test_simple_fractions_are_spoken() -> None:
normalized = _normalize_for_pipeline("Add 1/2 cup of sugar")
assert "one half" in normalized.lower()
def test_contractions_can_be_kept_when_override_disabled() -> None:
normalized = _normalize_for_pipeline(
"It's a good day.",
normalization_overrides={"normalization_apostrophes_contractions": False},
)
assert "It's" in normalized
def test_sibilant_possessives_remain_when_marking_disabled() -> None:
normalized = _normalize_for_pipeline(
"The boss's chair wobbled.",
normalization_overrides={"normalization_apostrophes_sibilant_possessives": False},
)
assert "boss's" in normalized
assert "boss iz" not in normalized.lower()
def test_decades_can_skip_expansion_when_disabled() -> None:
normalized = _normalize_for_pipeline(
"Classic hits from the '90s filled the hall.",
normalization_overrides={"normalization_apostrophes_decades": False},
)
assert "'90s" in normalized