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(phrase, boost)
Parameters
phrase-
A string containing a word or phrase you want boosted.
boostOptional-
A floating point number between
0.0and10.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 thephrasemore likely to be recognized. A value of0.0means the phrase is not boosted at all, whereas a value of10.0means the phrase is extremely likely to appear. If not specified, theboostdefaults to1.0.Note: A high value such as
9.0or10.0might make the recognition engine erroneously recognize other phrases as the specified phrase. Therefore, such values should be used rarely when constructingSpeechRecognitionPhraseobjects.
Return value
A new SpeechRecognitionPhrase object.
Exceptions
SyntaxErrorDOMException-
The specified
boostvalue is less than0.0or greater than10.0.
Specifications
| Specification |
|---|
| Web Speech API> # dom-speechrecognitionphrase-speechrecognitionphrase> |