SpeechRecognition: nomatch イベント

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

nomatchウェブ音声 API のイベントで、音声認識サービスが明確に認識できたものなしに最終結果を返したときに発生します。

confidence の閾値を超えたり満たしたりしない程度の認識がされた場合も含まれます。

構文

このイベント名を addEventListener() などのメソッドで使用するか、イベントハンドラープロパティを設定するかしてください。

js
addEventListener("nomatch", (event) => {});

onnomatch = (event) => {};

イベント型

イベントプロパティ

以下に列挙したプロパティに加えて、親インターフェイスである Event から継承したプロパティも利用できます。

SpeechRecognitionEvent.emma 読取専用

結果の EMMA (Extensible MultiModal Annotation markup language) - XML - 表現を返します。

SpeechRecognitionEvent.interpretation 読取専用

ユーザーが言ったことの意味づけを返します。

SpeechRecognitionEvent.resultIndex 読取専用

実際に変更された SpeechRecognitionResultList 「配列」の中で最もインデックス値の小さい結果を返します。

SpeechRecognitionEvent.results 読取専用

現在のセッションのすべての音声認識結果を表す SpeechRecognitionResultList オブジェクトを返します。

nomatch イベントは、 addEventListener メソッドで使用することができます。

js
const recognition = new webkitSpeechRecognition() || new SpeechRecognition();

recognition.addEventListener("nomatch", (event) => {
  console.error("音声が認識されませんでした");
});

または onnomatch イベントハンドラープロパティを使用してください。

js
recognition.onnomatch = () => {
  console.error("音声が認識されませんでした");
};

仕様書

Specification
Web Speech API
# eventdef-speechrecognition-nomatch
Web Speech API
# dom-speechrecognition-onnomatch

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
nomatch event

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

関連情報