alphacep / vosk-api

Offline speech recognition API for Android, iOS, Raspberry Pi and servers with Python, Java, C# and Node
Apache License 2.0
7.36k stars 1.04k forks source link

Not clear how to update recognizer vocabulary in runtime #1537

Closed RiccaDS closed 3 months ago

RiccaDS commented 3 months ago

Hi, I don't understand how to add words to the dictionary without rebuilding the model. From the Vosk website, in the "adaptation" section, I am pointed to the following code snippet: https://github.com/alphacep/vosk-api/blob/master/python/example/test_words.py I have added only the following line to my code rec = KaldiRecognizer(model, args.samplerate, '["[unk]","python", "elisa""]') however the words that can be recognized are only those in the list and no other words. Is this normal behavior?

Also what the SetGrammar method do in the example snippet? Thank you

nshmyrev commented 3 months ago

For now it is not possible to add vocabulary in runtime, you have to recompile the model. See here

https://github.com/alphacep/vosk-api/issues/725