Strip punctuation from spoken alerts - #508
Conversation
Deploying mouseterm with
|
| Latest commit: |
7788350
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1da081f3.mouseterm.pages.dev |
| Branch Preview URL: | https://speak-punctuation.mouseterm.pages.dev |
dormouse-bot
left a comment
There was a problem hiding this comment.
Two things on the widened strip set. The regex itself is right — Cc fully covers the \u0000-\u001f\u007f-\u009f range it replaces, and </>/+/= are Sm while &/* are Po, so no guard was dropped — and nothing else in the repo carries a copy of the old [<>&*] pattern to keep in sync.
Apostrophes now orphan the letter after them. toSpokenText("build didn’t finish") returns build didn t finish, and a terminal-supplied OSC 0/2 title is exactly where English prose reaches speech. That works against the bullet’s own goal: the reason * is substituted is so eight * is not announced as "eight asterisk", but didn t hands the engine a bare t to announce for the same reason. Eliding rather than space-substituting the apostrophe fixes it in one line and leaves every existing case alone (I checked "'''" → terminal and the combined punctuation case both still hold).
The spec understates \p{C}. It is General_Category=Other, not just control characters — it also strips the bidi and zero-width format characters. That is worth naming rather than losing, because the toPushText bullet a few lines down documents stripping exactly that class as a named security control ("can visually reorder or hide text in an OS notification"); as written, a reader asking whether a bidi override reaches the speech engine gets "yes" from the spec and "no" from the code. The suggested wording is sized to the word budget — alert.md is at 7333 of 7350, and it lands at 7342.
If you take both, the bullet needs the apostrophe carve-out too — appending , except apostrophes, which are elided so contractions survive after become spaces lands alert.md at exactly 7350 words, which the ratchet still passes (words > budget is the failure test).
Summary
Verification