SpeechRecognitionPhrase: SpeechRecognitionPhrase() constructor
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The SpeechRecognitionPhrase()
constructor creates a new SpeechRecognitionPhrase
object.
An array of SpeechRecognitionPhrase
objects is passed into the speech recognition engine via the SpeechRecognition.phrases
property for contextual biasing.
Syntax
new SpeechRecognitionPhrase(phrase)
new SpeechRecognitionPhrase(boost, phrase)
Parameters
boost
Optional-
A floating point number between
0.0
and10.0
(inclusive) that represents the weight you want to apply to thephrase
. This value is roughly equivalent to the natural log of the number of times more likely the website thinks this phrase to appear than what the speech recognition model knows. Higher values make thephrase
more likely to be recognized. A value of0.0
means the phrase is not boosted at all, whereas a value of10.0
means the phrase is extremely likely to appear. If not specified, theboost
defaults to1.0
.Note: A high value such as
9.0
or10.0
might make the recognition engine erroneously recognize other phrases as the specified phrase. Therefore, such values should be used rarely when constructingSpeechRecognitionPhrase
objects. phrase
-
A string containing a word or phrase you want boosted.
Return value
A new SpeechRecognitionPhrase
object.
Exceptions
SyntaxError
DOMException
-
The specified
boost
value is less than0.0
or greater than10.0
.
Specifications
Specification |
---|
Web Speech API> # dom-speechrecognitionphrase-speechrecognitionphrase> |
Browser compatibility
Loading…