-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
74 lines (49 loc) · 2.34 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
title: "SpeechRecognition: nomatch event"
short-title: nomatch
slug: Web/API/SpeechRecognition/nomatch_event
page-type: web-api-event
browser-compat: api.SpeechRecognition.nomatch_event
---
{{APIRef("Web Speech API")}}
The **`nomatch`** event of the [Web Speech API](/en-US/docs/Web/API/Web_Speech_API) is fired when the speech recognition service returns a final result with no significant recognition.
This may involve some degree of recognition, which doesn't meet or exceed the {{domxref("SpeechRecognitionAlternative.confidence","confidence")}} threshold.
## Syntax
Use the event name in methods like {{domxref("EventTarget.addEventListener", "addEventListener()")}}, or set an event handler property.
```js
addEventListener("nomatch", (event) => {});
onnomatch = (event) => {};
```
## Event type
A {{domxref("SpeechRecognitionEvent")}}. Inherits from {{domxref("Event")}}.
{{InheritanceDiagram("SpeechRecognitionEvent")}}
## Event properties
_In addition to the properties listed below, properties from the parent interface, {{domxref("Event")}}, are available._
- {{domxref("SpeechRecognitionEvent.emma")}} {{ReadOnlyInline}}
- : Returns an Extensible MultiModal Annotation markup language (EMMA) — XML — representation of the result.
- {{domxref("SpeechRecognitionEvent.interpretation")}} {{ReadOnlyInline}}
- : Returns the semantic meaning of what the user said.
- {{domxref("SpeechRecognitionEvent.resultIndex")}} {{ReadOnlyInline}}
- : Returns the lowest index value result in the {{domxref("SpeechRecognitionResultList")}} "array" that has actually changed.
- {{domxref("SpeechRecognitionEvent.results")}} {{ReadOnlyInline}}
- : Returns a {{domxref("SpeechRecognitionResultList")}} object representing all the speech recognition results for the current session.
## Examples
You can use the `nomatch` event in an [`addEventListener`](/en-US/docs/Web/API/EventTarget/addEventListener) method:
```js
const recognition = new webkitSpeechRecognition() || new SpeechRecognition();
recognition.addEventListener("nomatch", () => {
console.error("Speech not recognized");
});
```
Or use the `onnomatch` event handler property:
```js
recognition.onnomatch = () => {
console.error("Speech not recognized");
};
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- [Web Speech API](/en-US/docs/Web/API/Web_Speech_API)