Is there a way to use a grammar with the HTML 5 speech input API?
Asked Answered
K

2

10

I'm working with the HTML 5 speech input API and I want to let the server know which answers it can expect to be returned from the speech input. Is there a way to set a list of possible inputs?

Kinakinabalu answered 30/12, 2011 at 20:30 Comment(2)
Link to newer related question: #16884109Massa
Also #7434301Bicollateral
B
10

In Google Chrome you can not use grammars yet, overall they decided to use free-form recognition only. Relevant question is Grammar in Google speech API.

Grammars are supported in Firefox Web Speech API, but the feature is experimental.

If your browser supports HTML5 audio, you might want to try to recognize words from your grammar using Pocketsphinx.js library, it provides javascript-based recognizer which should be very good for grammars.

Bicollateral answered 2/7, 2013 at 17:21 Comment(6)
I tried pocket sphinx, but it only hears me say 'four'. The rest of the time it's random results, sometimes 4-5 seconds after I stop talking.Confuse
You can create a separate question about that. You need to provide all necessary details - what code do you run exactly and so on.Bicollateral
I used the live demo on their website. Their code not mine. It would not work with Firefox Chrome or on Android or iOS for me...Confuse
Which browser version exactly, which OS, what device? The more details you provide the faster you get solution to a problem.Bicollateral
That pocketsphinx library really does not work. I have the same problem as @Confuse and I have lots of problems regarding City grammar. I would not install it.Confidant
Yes, if gramamr is large you need different solution.Bicollateral
C
2

I assume your a talking about the Speech Input API Specification as defined by the W3C. According to this specification grammars are supported, which is the method used by speech recognition systems to restrict possible inputs. Look for the section titled "Speech recognition grammars". The problem will be how well it is supported in the particular browser that is being used, which is the case for an HTML 5 specific function since it is not a completed standard yet. Chrome seems to be the most up to date with the standard. Checkout this blog post from the Chrome team on implementing the Speech Input API.

Cosmography answered 11/1, 2012 at 18:40 Comment(2)
Chrome is the one that seems more reliable from my trials, but from the link above to an older question (4 years ago) it says Chrome has disabled the grammar usage for now... I would be happy JUST adjusting the weight of certain words, but it does not seem to want me to do that either.Confuse
Just to confirm, that as of April 2020, Chrome does not use provided grammars. No explicit error, just seems to ignore it completely.Hamhung

© 2022 - 2024 — McMap. All rights reserved.