SpeechRecognition: nomatch イベント
nomatch
はウェブ音声 API のイベントで、音声認識サービスが明確に認識できたものなしに最終結果を返したときに発生します。
confidence
(en-US) の閾値を超えたり満たしたりしない程度の認識がされた場合も含まれます。
構文
このイベント名を addEventListener()
などのメソッドで使用するか、イベントハンドラープロパティを設定するかしてください。
addEventListener('nomatch', (event) => { })
onnomatch = (event) => { }
イベント型
SpeechRecognitionEvent
です。 Event
を継承しています。
イベントプロパティ
以下に列挙したプロパティに加えて、親インターフェイスである Event
から継承したプロパティも利用できます。
SpeechRecognitionEvent.emma
読取専用-
結果の EMMA (Extensible MultiModal Annotation markup language) - XML - 表現を返します。
SpeechRecognitionEvent.interpretation
読取専用-
ユーザーが言ったことの意味づけを返します。
SpeechRecognitionEvent.resultIndex
読取専用-
実際に変更された
SpeechRecognitionResultList
(en-US) 「配列」の中で最もインデックス値の小さい結果を返します。 SpeechRecognitionEvent.results
読取専用-
現在のセッションのすべての音声認識結果を表す
SpeechRecognitionResultList
(en-US) オブジェクトを返します。
例
nomatch
イベントは、 addEventListener
メソッドで使用することができます。
const recognition = new webkitSpeechRecognition() || new SpeechRecognition();
recognition.addEventListener('nomatch', (event) => {
console.error('音声が認識されませんでした');
});
または onnomatch
イベントハンドラープロパティを使用してください。
recognition.onnomatch = () => {
console.error('音声が認識されませんでした');
}
仕様書
Specification |
---|
Web Speech API # eventdef-speechrecognition-nomatch |
Web Speech API # dom-speechrecognition-onnomatch |
ブラウザーの互換性
BCD tables only load in the browser