Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing grammars #1

Open
msub2 opened this issue Dec 8, 2022 · 1 comment
Open

Implementing grammars #1

msub2 opened this issue Dec 8, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@msub2
Copy link
Owner

msub2 commented Dec 8, 2022

So, during the research I was doing on the existing implementation of SpeechRecognition in other browsers I learned a bit about speech grammars and how they're implemented in the API across browsers. Specifically, that they aren't. You can see there's an open, 5-year-old bug on the Chromium bugtracker about it, with basically no communication from anyone on Google about it. This further adds to the sort of black box aspect of how the API is implemented, as the audio is passed to Google's servers for processing, but it would seem that they simply haven't chosen to support grammars.

But if grammars are basically useless in Chrome, why are there examples on MDN calling SpeechGrammarList.addFromString() with a JSGF string? I wondered this too for a while, but after looking through Mozilla's bugtracker I think I've found my answer, which is that Firefox's initial implementation of the Web Speech API utilized PocketSphinx, which, you guessed it, uses JSGF for its grammars.

Which brings me to my main question, should this polyfill implement grammars? Speech recognition in general is still a fairly new field for me, so I don't really have a horse in this race either way, but there seems to be arguments both for and against it on the Web Speech repo itself, as well as the usage of grammars in general on the Vosk repo and on the PocketSphinx repo. If the polyfill were to support grammars, I think it would make sense to support SRGS too, as it is derived from JSGF.

But what do you think? Hopefully we can have some productive discussion on it and figure out ultimately what would be best, might even be some good data for those still managing the spec.

@msub2 msub2 added the enhancement New feature or request label Dec 8, 2022
@msub2 msub2 changed the title Implenting grammars Implementing grammars Dec 8, 2022
@fquirin
Copy link

fquirin commented Dec 9, 2022

It is possible to build language models out of JSGF grammar files. Way back in the days of ILA I used on-the-fly generation of language models from grammar (in a few milliseconds). It would certainly be interesting to explore this topic again for the SEPIA STT server since I was planning to add JSGF support in general to the SEPIA-Home server.
So far you can use word boosting (Coqui) and a phrase list (Vosk) to get something similar, but it is not really a grammar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants