v151 · speech · accessibility · forms
Web Speech API: Unspoken Punctuation
Chrome 151 adds an unspokenPunctuation boolean attribute to SpeechRecognition. When set to true, the speech recognition engine automatically infers and inserts punctuation — periods, commas, question marks — from the user's natural pauses and prosody, without requiring them to explicitly say "period" or "comma".
at a glance
| Shipped in | Chrome 151 (Enabled by default) |
|---|---|
| Status | Enabled by default |
| Standards position (Firefox) | Positive (Mozilla standards position #1416) |
| Standards position (Safari) | No signal (WebKit standards position #678) |
| Spec PR | web-speech-api PR #188 |
| ChromeStatus | 4785284026859520 — Web Speech API: Unspoken Punctuation (API record) |
why it exists
The existing Web Speech API returns transcript text but does not insert punctuation unless the user explicitly dictates it (e.g. says "Hello comma how are you period"). This produces run-on transcripts that require manual editing before use in prose contexts.
Many speech recognition systems — including mobile dictation on iOS, Android, and Windows — already infer punctuation from prosodic cues: a rising intonation ends with a question mark, a brief pause between clauses inserts a comma, a falling intonation followed by a longer pause inserts a period. As discussed in WebAudio/web-speech-api issue #187, the unspokenPunctuation attribute exposes this capability through the Web Speech API, enabling web apps to receive naturally punctuated transcripts without instructing users to speak punctuation aloud.
Syntax
Web IDL definition from the Web Speech API specification and PR #188 extending SpeechRecognition:
partial interface SpeechRecognition {
attribute boolean unspokenPunctuation;
};
Source: web-speech-api PR #188; Web Speech API spec
shape of the API
| Property | Type | Default | Description |
|---|---|---|---|
SpeechRecognition.unspokenPunctuation | boolean | false | When true, the recogniser inserts inferred punctuation into transcripts automatically |
The property must be set before calling start(). Setting it during recognition has no effect until the next session.
Inputs and parameters
The unspokenPunctuation attribute is a read/write boolean property on instances of SpeechRecognition. When assigning a value, standard JavaScript boolean coercion applies. Assigning true activates prosodic punctuation inference; assigning false leaves transcripts without automatic punctuation.
Outputs and return values
Reading unspokenPunctuation returns a boolean primitive value indicating whether unspoken punctuation inference is currently configured on the instance (defaulting to false). When enabled, transcription results emitted via SpeechRecognitionEvent results contain commas, periods, and question marks.
Errors and exceptions
Setting or reading unspokenPunctuation does not raise exceptions under normal operation. If the getter or setter is invoked on an incompatible this value that does not implement SpeechRecognition, the Web IDL binding layer throws a TypeError: Illegal invocation.
Execution context and exposure
The SpeechRecognition interface and its unspokenPunctuation property are exposed on the Window global object in browser documents. They are not exposed to Web Worker or Service Worker contexts because audio capture is tightly bound to document user activation and permissions.
Lifecycle and state transitions
The unspokenPunctuation setting must be configured before calling recognition.start(). Modifying the property while the speech recognition session is active (between the start and end events) does not affect the active session; the updated setting takes effect on the next session invocation.
Examples
const recognition = new SpeechRecognition();
recognition.lang = 'en-US';
recognition.continuous = true;
recognition.interimResults = true;
// Chrome 151+: automatically add punctuation from prosody
recognition.unspokenPunctuation = true;
recognition.onresult = (event) => {
let transcript = '';
for (let i = event.resultIndex; i < event.results.length; i++) {
const result = event.results[i];
transcript += result[0].transcript;
if (result.isFinal) {
// Without unspokenPunctuation: "hello how are you doing today"
// With unspokenPunctuation: "Hello, how are you doing today?"
document.querySelector('#output').textContent += transcript;
}
}
};
recognition.start();
Source: chromestatus feature summary; sample available at speech.evanliu.com
Browser compatibility
| Browser | Support | Notes |
|---|---|---|
| Chrome 151+ | Enabled by default | All desktop and Android platforms (Chromium issue 514764702) |
| Firefox | Positive | Not yet shipped (standards position) |
| Safari | No signal | standards position issue |
Security and privacy considerations
Using unspokenPunctuation does not introduce new audio capture permissions or cross-origin attack vectors. Audio capture remains gated by existing browser microphone consent and user permission prompts. Punctuation inference occurs within the speech recognition pipeline and does not grant access to raw audio buffers.
see also
- Chrome Platform Status — Web Speech API: Unspoken Punctuation
- ChromeStatus API record (4785284026859520)
- Chromium Issue 514764702
- WebAudio/web-speech-api PR #188: Add unspokenPunctuation
- WebAudio/web-speech-api Issue #187
- Web Speech API specification (WebAudio)
- WICG Web Speech API specification
- Evan Liu — Unspoken Punctuation Sample
- Mozilla Standards Position #1416
- WebKit Standards Position #678
- MDN Web Docs — SpeechRecognition
- WPT results — webspeech suite