Web Speech API Custom Words

I read through the W3C docs about this, and I think the user words are taken from the user grammar, but I tried to go to this demo and entered the following javascript on the console:

recognition.grammars.addFromString('foo'); 

Which works fine, but recognition.grammars[0].src returns: "data:application/xml,foo"

Note : "foo" is not the word that interests me, but the word that interests me is not an English word, using "foo" as an example. When I usually say my usual word, he thinks that I am saying something else (which makes sense). I use "foo" here to protect my brand :)

So I want to say “Hey foo”, similar to how “Good Google” works. But my word "foo" is not an actual word, so SpeechRecognitionResult does not have my custom word.

I don’t understand how to add custom words, or is it impossible today?

+7
javascript html5 w3c speech-recognition speech-to-text
source share
1 answer

When I usually say my usual word, he thinks that I am saying something else (which makes sense).

Google provides a very limited implementation of the speech API without grammar support, see the question about this:

Grammar in the Google Speech API

More, even the original specification is not complete in terms of grammars and their processing.

So I want to say “Hey foo”, similar to how “Good Google” works. But my word "foo" is not an actual word, so SpeechRecognitionResult does not have my custom word.

This task is not a speech recognition task, therefore it cannot be effectively solved using the speech recognition mechanism, this requires the definition of keywords, because it is necessary to filter out all speech except the keyword.

You can try to implement this using the Pocketsphinx javascript library ( http://cmusphinx.sourceforge.net/2013/06/voice-enable-your-website-with-cmusphinx/ ). With pocketsphinx, it’s easier to debug pronunciation problems there too.

See also the Web Speech API - SpeechGrammar , which specifically describes grammar support.

+4
source share

All Articles