Skip to content

fix(asr): keep punctuation around vocabulary replacements - #1088

Merged
Alex-Wengg merged 2 commits into
FluidInference:mainfrom
kiranjd:fix/vocab-preserve-boundary-punctuation
Nov 1, 2026
Merged

Alex-Wengg merged 2 commits into
FluidInference:mainfrom
kiranjd:fix/vocab-preserve-boundary-punctuation

Conversation

@kiranjd

@kiranjd kiranjd commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Why is this change needed?

A vocabulary replacement writes the bare term over the matched words and drops their punctuation. With Speakmac in the vocabulary, …with Speak Mac, let's see… becomes …with Speakmac let's see… (CLI on main, Parakeet v3). #1041 keeps possessives; this keeps the rest.

What changes?

  • applyReplacement keeps the closing punctuation of the span's last word and the opening punctuation of its first (preservingBoundaryPunctuation, next to preservingPossessive).
  • Punctuation between the span's words is dropped (Chat, GPT, → ChatGPT,). Apostrophes stay with preservingPossessive.
  • replacementWord is still the bare term, so ctcAppliedTerms is unchanged.

Validation

  • New 14-case table test.
  • All 203 vocabulary and rescoring tests pass, including the real-speech suites with FLUIDAUDIO_RUN_ASR_E2E=1.
  • swift format lint is clean.

🤖 Generated with Claude Code

kiranjd and others added 2 commits November 1, 2026 18:00
A replacement wrote the bare term over the matched words, dropping their
punctuation: "Speak Mac, let's" became "Speakmac let's". Keep the closing
punctuation of the span's last word and the opening punctuation of its
first word; apostrophes stay with preservingPossessive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A term that ends in punctuation ("Inc.", "Yahoo!") kept the whole closing run of the span, so "Acme Ink.," became "Acme Inc..,". Add only the part of the opening and closing runs the term doesn't already carry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants