Custom Grammar Support
joeladria opened this issue · 4 comments
Any chance grammar loading will be implemented?
It should be very easy to send a grammar message to configure the recognizer! Please submit a patch or let us know if you need help implementing it!
I wish I could help out but my C experience isn't quite at that level unfortunately! I've only found the grammar implementation examples for Python so far... https://github.com/alphacep/vosk-api/blob/master/python/example/test_words.py
Looking for some feedback, I tried my hand at making it work.
Asterisk res_speech specifies the loading of grammar files which are then named at load time and then unloaded. Does vosk support or implement these grammar files at all?
In my implementation I've simply used the "name" string as input with the array of words to pass to the model in JSON format. Works nicely, but a bit of a hack. What do you think?
Yup, something like this should work. It needs a bit more love though for full integration.