-
Notifications
You must be signed in to change notification settings - Fork 22.9k
Editorial review: Document new web speech api features #41145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
chrisdavidmills
wants to merge
13
commits into
mdn:main
Choose a base branch
from
chrisdavidmills:on-device-speech-recognition
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1fa4ff9
Document new web speech api features
chrisdavidmills 09b3279
Add contextual biasing features
chrisdavidmills 63d178d
Add ref pages for the on-device recognition features
chrisdavidmills d269e6d
Make it clear that the grammar functionality is deprecated and non-fu…
chrisdavidmills 8ea7d00
Add SpeechRecognitionEvent() constructor ref page, and remove emma an…
chrisdavidmills f6d2a3b
Add SpeechRecognitionErrorEvent() constructor page
chrisdavidmills 10509c0
Adding details of start() method with MediaStreamTrack argument WIP
chrisdavidmills c919c9a
Finish documenting start(audioTrack)
chrisdavidmills 150e3b1
Update example code for consistency with dom-examples demo updates
chrisdavidmills 3fabb76
Fixes for evanbliu review comments
chrisdavidmills 84f4f31
Merge branch 'main' into on-device-speech-recognition
chrisdavidmills d3f95d6
A few more fixes
chrisdavidmills cd390d5
Merge branch 'main' into on-device-speech-recognition
chrisdavidmills File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,39 +3,40 @@ title: SpeechGrammarList | |
slug: Web/API/SpeechGrammarList | ||
page-type: web-api-interface | ||
status: | ||
- experimental | ||
- deprecated | ||
browser-compat: api.SpeechGrammarList | ||
--- | ||
|
||
{{APIRef("Web Speech API")}}{{SeeCompatTable}} | ||
{{APIRef("Web Speech API")}}{{deprecated_header}} | ||
|
||
The **`SpeechGrammarList`** interface of the [Web Speech API](/en-US/docs/Web/API/Web_Speech_API) represents a list of {{domxref("SpeechGrammar")}} objects containing words or patterns of words that we want the recognition service to recognize. | ||
|
||
Grammar is defined using [JSpeech Grammar Format](https://www.w3.org/TR/jsgf/) (**JSGF**.) Other formats may also be supported in the future. | ||
Grammar is defined using [JSpeech Grammar Format](https://www.w3.org/TR/jsgf/) (**JSGF**). | ||
|
||
> [!NOTE] | ||
> The whole concept of grammar has been removed from the Web Speech API. Related features have been kept in the specification and are still recognized by supporting browsers for backwards compatibility purposes, but they have no effect on speech recognition services. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same edit suggestions |
||
|
||
## Constructor | ||
|
||
- {{domxref("SpeechGrammarList.SpeechGrammarList", "SpeechGrammarList()")}} {{Experimental_Inline}} | ||
- {{domxref("SpeechGrammarList.SpeechGrammarList", "SpeechGrammarList()")}} {{deprecated_inline}} | ||
- : Creates a new `SpeechGrammarList` object. | ||
|
||
## Instance properties | ||
|
||
- {{domxref("SpeechGrammarList.length")}} {{ReadOnlyInline}} {{Experimental_Inline}} | ||
- {{domxref("SpeechGrammarList.length")}} {{ReadOnlyInline}} {{deprecated_inline}} | ||
- : Returns the number of {{domxref("SpeechGrammar")}} objects contained in the `SpeechGrammarList`. | ||
|
||
## Instance methods | ||
|
||
- {{domxref("SpeechGrammarList.item()")}} {{Experimental_Inline}} | ||
- {{domxref("SpeechGrammarList.item()")}} {{deprecated_inline}} | ||
- : Standard getter — allows individual {{domxref("SpeechGrammar")}} objects to be retrieved from the `SpeechGrammarList` using array syntax. | ||
- {{domxref("SpeechGrammarList.addFromURI()")}} {{Experimental_Inline}} | ||
- {{domxref("SpeechGrammarList.addFromURI()")}} {{deprecated_inline}} | ||
- : Takes a grammar present at a specific URI and adds it to the `SpeechGrammarList` as a new {{domxref("SpeechGrammar")}} object. | ||
- {{domxref("SpeechGrammarList.addFromString()")}} {{Experimental_Inline}} | ||
- {{domxref("SpeechGrammarList.addFromString()")}} {{deprecated_inline}} | ||
- : Adds a grammar in a string to the `SpeechGrammarList` as a new {{domxref("SpeechGrammar")}} object. | ||
|
||
## Examples | ||
|
||
In our simple [Speech color changer](https://github.com/mdn/dom-examples/tree/main/web-speech-api/speech-color-changer) example, we create a new `SpeechRecognition` object instance using the {{domxref("SpeechRecognition.SpeechRecognition", "SpeechRecognition()")}} constructor, create a new `SpeechGrammarList`, add our grammar string to it using the {{domxref("SpeechGrammarList.addFromString")}} method, and set it to be the grammar that will be recognized by the `SpeechRecognition` instance using the {{domxref("SpeechRecognition.grammars")}} property. | ||
|
||
```js | ||
const grammar = | ||
"#JSGF V1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;"; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.