SpeechRecognition: Thuộc tính maxAlternatives
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Thuộc tính maxAlternatives của giao diện SpeechRecognition thiết lập số lượng tối đa SpeechRecognitionAlternative được cung cấp cho mỗi SpeechRecognitionResult.
Giá trị mặc định là 1.
Giá trị
Một số biểu diễn số lượng phương án thay thế tối đa được trả về cho mỗi kết quả.
Ví dụ
Đoạn mã này được trích từ ví dụ Speech color changer của chúng ta.
js
const recognition = new SpeechRecognition();
recognition.lang = "en-US";
recognition.interimResults = false;
recognition.maxAlternatives = 1;
// …
Đặc tả kỹ thuật
| Specification |
|---|
| Web Speech API> # dom-speechrecognition-maxalternatives> |