Skip to content

google-transcribe: numerals support via digit-sequence class token - #99

Merged
pragmatrix merged 4 commits into
masterfrom
google-transcribe-numerals
Sep 16, 2026
Merged

pragmatrix merged 4 commits into
masterfrom
google-transcribe-numerals

Conversation

@pragmatrix

Copy link
Copy Markdown
Owner

Why

Spoken numbers ("nine four one two") are transcribed as words ("nine four one two") instead of digits ("9412") by Google Speech-to-Text V2. Applications that need numeric output (dial pads, quantities, prices) have to post-process every transcript. Google offers speech adaptation class tokens exactly for this, and the service had no way to use them.

Summary

  • Add a numerals parameter to the Google transcribe service. When set, an inline PhraseSet with the $OOV_CLASS_DIGIT_SEQUENCE class token (boost 20.0, taken over from the internal FreeSWITCH-parameterized setup) is sent as RecognitionConfig.adaptation (ADR 0005).
  • Restructure google_transcribe::Params into region + flattened TranscribeParams (model, language, diarization, numerals) so recognition parameters can be passed through to the client; all new fields default, so existing configs keep working.
  • Final results now take the first alternative directly: Google only populates confidence on the top alternative, so the previous confidence-based re-ranking compared unknown values. max_alternatives is hardcoded to 1 accordingly. The rejected re-ranking approach is documented in ADR 0005.
  • The example CLI accepts --numerals for the Google provider.

Validation

  • cargo test -p context-switch -p google-transcribe passes (4 passed, 1 ignored).
  • cargo fmt -- --check clean.
  • Workspace version bumped to 3.8.0 (new public service parameter).

AI disclosure

This pull request was developed with assistance from GitHub Copilot (GLM-5.3-Flash). All code was reviewed and approved by the human author before submission.

@pragmatrix
pragmatrix merged commit 6c6b0cd into master Sep 16, 2026
3 checks passed
@pragmatrix
pragmatrix deleted the google-transcribe-numerals branch September 16, 2026 12:59
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.

1 participant