diff --git a/index.bs b/index.bs
index 0638cba..b05aef0 100644
--- a/index.bs
+++ b/index.bs
@@ -163,7 +163,7 @@ The term "interim result" indicates a {{SpeechRecognitionResult}} in which the {
: [[phrases]]
::
- A {{SpeechRecognitionPhraseList}} representing a list of phrases for contextual biasing. The initial value is null.
+ An {{ObservableArray}} of {{SpeechRecognitionPhrase}} objects representing a list of phrases for contextual biasing. The initial value is a new empty {{ObservableArray}}.
@@ -178,7 +178,7 @@ interface SpeechRecognition : EventTarget {
attribute boolean interimResults;
attribute unsigned long maxAlternatives;
attribute boolean processLocally;
- attribute SpeechRecognitionPhraseList phrases;
+ attribute ObservableArray phrases;
// methods to drive the speech interaction
undefined start();
@@ -298,16 +298,6 @@ interface SpeechRecognitionPhrase {
readonly attribute DOMString phrase;
readonly attribute float boost;
};
-
-// The object representing a list of phrases for contextual biasing.
-[SecureContext, Exposed=Window]
-interface SpeechRecognitionPhraseList {
- constructor(sequence phrases);
- readonly attribute unsigned long length;
- SpeechRecognitionPhrase item(unsigned long index);
- undefined addItem(SpeechRecognitionPhrase item);
- undefined removeItem(unsigned long index);
-};
SpeechRecognition Attributes
@@ -347,18 +337,11 @@ interface SpeechRecognitionPhraseList {
phrases attribute
- This attribute represents a list of phrases for contextual biasing.
+ The `phrases` attribute provides a list of {{SpeechRecognitionPhrase}} objects to be used for contextual biasing. This is an {{ObservableArray}}, which can be modified like a JavaScript `Array` (e.g., using `push()`).
The getter steps are to return the value of {{SpeechRecognition/[[phrases]]}}.
-
- The setter steps are:
- 1. If the {{SpeechRecognitionPhraseList/length}} of the given value is greater than 0 and the system does not support contextual biasing,
- throw a {{SpeechRecognitionErrorEvent}} with the {{phrases-not-supported}} error code and abort these steps.
- 1. Set {{SpeechRecognition/[[phrases]]}} to the given value.
- 1. Send a copy of {{SpeechRecognition/[[phrases]]}} to the system for initializing or updating the phrases for contextual biasing implementation.
-
The group has discussed whether WebRTC might be used to specify selection of audio sources and remote recognizers.
@@ -506,6 +489,9 @@ following steps:
1. If {{SpeechRecognition/[[started]]}} is `true` and no error event or end event
has fired on it, throw an {{InvalidStateError}} and abort these steps.
+1. If this.{{SpeechRecognition/phrases}}'s `length` is greater than 0 and the user agent does not support contextual biasing:
+ 1. [=Queue a task=] to [=fire an event=] named error at [=this=] using {{SpeechRecognitionErrorEvent}} with its {{SpeechRecognitionErrorEvent/error}} attribute initialized to `phrases-not-supported` and its {{SpeechRecognitionErrorEvent/message}} attribute set to an implementation-defined string detailing the reason.
+ 1. Abort these steps.
1. If this.{{SpeechRecognition/[[processLocally]]}} is `true`:
1. If the user agent determines that local speech recognition is not available for this.{{SpeechRecognition/lang}}, or if it cannot fulfill the local processing requirement for other reasons:
1. [=Queue a task=] to [=fire an event=] named error at [=this=] using {{SpeechRecognitionErrorEvent}} with its {{SpeechRecognitionErrorEvent/error}} attribute initialized to {{SpeechRecognitionErrorCode/service-not-allowed}} and its {{SpeechRecognitionErrorEvent/message}} attribute set to an implementation-defined string detailing the reason.
@@ -727,59 +713,6 @@ For a non-continuous recognition it will hold only a single value.
This attribute returns the value of {{[[boost]]}}.
-SpeechRecognitionPhraseList
-
-The SpeechRecognitionPhraseList object holds a list of phrases for contextual biasing and has the following internal slot:
-
-
- : [[phrases]]
- ::
- A list of {{SpeechRecognitionPhrase}} representing the phrases to be boosted. The initial value is an empty list.
-
-
-
- - SpeechRecognitionPhraseList(|phrases|) constructor
- -
- When this constructor is invoked, run the following steps:
- 1. Let |list| be a new object of type {{SpeechRecognitionPhraseList}}.
- 1. Set |list|.{{SpeechRecognitionPhraseList/[[phrases]]}} to be the value of |phrases|.
- 1. Return |list|.
-
-
- - length attribute
- -
- This attribute indicates the number of phrases in the list.
- When invoked, return the number of items in {{SpeechRecognitionPhraseList/[[phrases]]}}.
-
-
- - item(|index|) method
- -
- This method gets the {{SpeechRecognitionPhrase}} object at the |index| of the list.
- When invoked, run the following steps:
- 1. If |index| is smaller than 0, or greater than or equal to {{SpeechRecognitionPhraseList/length}},
- throw a {{RangeError}} and abort these steps.
- 1. Return the {{SpeechRecognitionPhrase}} at the |index| of {{SpeechRecognitionPhraseList/[[phrases]]}}.
-
-
- - addItem(|item|) method
- -
- This method adds the {{SpeechRecognitionPhrase}} object |item| to the list.
- When invoked, add |item| to the end of {{SpeechRecognitionPhraseList/[[phrases]]}}.
- The list is allowed to have multiple {{SpeechRecognitionPhrase}} objects with the same {{SpeechRecognitionPhrase/[[phrase]]}} value,
- and the speech recognition model should use the last {{SpeechRecognitionPhrase/[[boost]]}} value
- for this {{SpeechRecognitionPhrase/[[phrase]]}} in the list.
-
-
- - removeItem(|index|) method
- -
- This method removes the {{SpeechRecognitionPhrase}} object at the |index| of the list.
- When invoked, run the following steps:
- 1. If |index| is smaller than 0, or greater than or equal to {{SpeechRecognitionPhraseList/length}},
- throw a {{RangeError}} and abort these steps.
- 1. Remove the {{SpeechRecognitionPhrase}} object at the |index| of {{SpeechRecognitionPhraseList/[[phrases]]}}.
-
-
-
SpeechGrammar
The SpeechGrammar object represents a container for a grammar.