SpeechRecognitionAlternative: thuộc tính confidence
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Thuộc tính chỉ đọc confidence của giao diện SpeechRecognitionResult trả về ước tính số về mức độ tự tin của hệ thống nhận dạng giọng nói rằng việc nhận dạng là đúng.
Note:
Triển khai confidence của Mozilla vẫn đang được xử lý — hiện tại, nó luôn dường như trả về 1.
Giá trị
Một số trong khoảng 0 đến 1.
Ví dụ
Code này được trích từ ví dụ Speech color changer của chúng tôi.
js
recognition.onresult = (event) => {
const color = event.results[0][0].transcript;
diagnostic.textContent = `Nhận được kết quả: ${color}.`;
bg.style.backgroundColor = color;
console.log(`Độ tin cậy: ${event.results[0][0].confidence}`);
};
Thông số kỹ thuật
| Specification |
|---|
| Web Speech API> # dom-speechrecognitionalternative-confidence> |