SpeechRecognitionAlternative: confidence property
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Want more browser support for this feature? Tell us why.
The confidence read-only property of the SpeechRecognitionAlternative interface returns a numeric estimate of how confident the speech recognition system is that the recognition is correct.
Value
A number between 0 and 1, where higher values mean the recognition system is more confident.
Examples
This code is excerpted from our Speech color changer example.
js
recognition.onresult = (event) => {
const color = event.results[0][0].transcript;
diagnostic.textContent = `Result received: ${color}.`;
bg.style.backgroundColor = color;
console.log(`Confidence: ${event.results[0][0].confidence}`);
};
Specifications
| Specification |
|---|
| Web Speech API> # dom-speechrecognitionalternative-confidence> |