Codex Ablation commited on
Commit
3352f9f
·
1 Parent(s): 9bdf15e

Accept proof-bound email separator romanization

Browse files
Files changed (2) hide show
  1. production.py +7 -0
  2. tests/test_production.py +50 -0
production.py CHANGED
@@ -5010,6 +5010,13 @@ def _network_fragment_mixed_render_pattern(spoken_fragment: str) -> str | None:
5010
  for alias, canonical_reading in _SIMPLIFIED_NETWORK_SYMBOL_READINGS.items()
5011
  if canonical_reading == canonical
5012
  )
 
 
 
 
 
 
 
5013
  spoken_variants.add(ascii_atom)
5014
  variants = sorted(
5015
  {
 
5010
  for alias, canonical_reading in _SIMPLIFIED_NETWORK_SYMBOL_READINGS.items()
5011
  if canonical_reading == canonical
5012
  )
5013
+ if canonical == "小老鼠":
5014
+ # Pinned Whisper decoders can romanize the audibly correct email
5015
+ # separator. These aliases remain one atom in this exact,
5016
+ # planner-range-bound lattice; the surrounding local part, domain,
5017
+ # TLD, ordering, and conservative identifier boundaries are still
5018
+ # mandatory and cannot be inferred from prose.
5019
+ spoken_variants.update({"xiaolaoshu", "xiaolaoshui"})
5020
  spoken_variants.add(ascii_atom)
5021
  variants = sorted(
5022
  {
tests/test_production.py CHANGED
@@ -1649,6 +1649,8 @@ def test_local_network_fragment_accepts_exact_mixed_long_form_email_domain():
1649
  (
1650
  "若要更換導覽場次請寄信到tour.help@islandmuseum.tw",
1651
  "若要更換導覽場次請寄信到tour.help小老鼠islandmuseum.tw",
 
 
1652
  ),
1653
  )
1654
  def test_atomic_email_chunk_accepts_only_exact_proof_bound_mixed_render(transcript):
@@ -1680,6 +1682,54 @@ def test_atomic_email_chunk_rejects_mixed_render_mutation():
1680
  assert evidence.passed is False
1681
 
1682
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1683
  @pytest.mark.parametrize(
1684
  "transcript",
1685
  (
 
1649
  (
1650
  "若要更換導覽場次請寄信到tour.help@islandmuseum.tw",
1651
  "若要更換導覽場次請寄信到tour.help小老鼠islandmuseum.tw",
1652
+ "若要更換導覽場次請寄信到tour.helpXiaolaoshuislandmuseum.tw",
1653
+ "若要更換導覽場次請寄信到tour.helpXiaolaoshuiislandmuseum.tw",
1654
  ),
1655
  )
1656
  def test_atomic_email_chunk_accepts_only_exact_proof_bound_mixed_render(transcript):
 
1682
  assert evidence.passed is False
1683
 
1684
 
1685
+ @pytest.mark.parametrize(
1686
+ "transcript",
1687
+ (
1688
+ "若要更換導覽場次請寄信到tour.helpXiaolaoshuiislandmuseum.com",
1689
+ "若要更換導覽場次請寄信到tour.helpXiaolaoshuiislandmuseurn.tw",
1690
+ "若要更換導覽場次請寄信到tour.helpXiaolaoshuiislandmuseum.t",
1691
+ "若要更換導覽場次請寄信到tour.helpXiaolaoshuiislandmuseum.twz",
1692
+ "若要更換導覽場次請寄信到tour.helpXiaolaoshuiislandmuseum.tw/x",
1693
+ "若要更換導覽場次請寄信到tour.helpXiaolaoshuiislandmuseum.tw?x",
1694
+ "若要更換導覽場次請寄信到tour.helpXiaolaoshuiislandmuseum.tw#x",
1695
+ "若要更換導覽場次請寄信到xtour.helpXiaolaoshuiislandmuseum.tw",
1696
+ "若要更換導覽場次請寄信到tour.helpxXiaolaoshuiislandmuseum.tw",
1697
+ "若要更換導覽場次請寄信到tour.helpXiaolaoshuixislandmuseum.tw",
1698
+ ),
1699
+ )
1700
+ def test_atomic_email_alias_rejects_content_and_boundary_mutations(transcript):
1701
+ raw = "若要更換導覽場次,請寄信到 tour.help@islandmuseum.tw。"
1702
+ target = normalize_spoken_forms(raw)
1703
+ spec = plan_generation_chunks(raw, target)[0]
1704
+
1705
+ evidence = canonicalize_asr_network_fragments(
1706
+ transcript,
1707
+ target,
1708
+ spec.network_fragment_proofs,
1709
+ )
1710
+
1711
+ assert evidence.protected_range_count == 1
1712
+ assert evidence.passed is False
1713
+
1714
+
1715
+ def test_atomic_email_alias_cannot_borrow_proof_from_url_path():
1716
+ raw = "若要更換導覽場次,請寄信到 tour.help@islandmuseum.tw。"
1717
+ target = normalize_spoken_forms(raw)
1718
+ spec = plan_generation_chunks(raw, target)[0]
1719
+
1720
+ evidence = canonicalize_asr_network_fragments(
1721
+ (
1722
+ "若要更換導覽場次請寄信到"
1723
+ "https://example.tw/tour.helpXiaolaoshuiislandmuseum.tw"
1724
+ ),
1725
+ target,
1726
+ spec.network_fragment_proofs,
1727
+ )
1728
+
1729
+ assert evidence.protected_range_count == 1
1730
+ assert evidence.passed is False
1731
+
1732
+
1733
  @pytest.mark.parametrize(
1734
  "transcript",
1735
  (