alphacep / vosk-android-demo

Offline speech recognition for Android with Vosk library.
Apache License 2.0
740 stars 198 forks source link

onPartialResult callback and grammar #214

Open matanel-6over6 opened 8 months ago

matanel-6over6 commented 8 months ago

First of all it works great and fast.

  1. onPartialResult callback called several times if I say one word, why?
  2. I have grammar(json array) and If I say a word that is not on the list, he still returns one of the words on the list. There is no option to identify that there is no match at all? Thanks for the help
nshmyrev commented 8 months ago

onPartialResult callback called several times if I say one word, why?

Partial results returned 5 times a second to provide you real-time updates.

I have grammar(json array) and If I say a word that is not on the list, he still returns one of the words on the list. There is no option to identify that there is no match at all?

Add a special [unk] word to the list

matanel-6over6 commented 8 months ago

Thanks for the fast answer. This is my json array: ["yes","no","none","next","zero","one","two","three","four","red","blue","green","yellow","white"]

I say 'five' and i get four

nshmyrev commented 8 months ago

You need to add "[unk]" to the list

matanel-6over6 commented 8 months ago

["yes","no","none","next","zero","one","two","three","four","red","blue","green","yellow","white", "[unk]"] like this? I say five and from onPartialResult i get four but from onFinalResult i get [unk]. why?

matanel-6over6 commented 8 months ago

I sat seven and i get in the first onPartialResult "zero" and after that i get [unk]

Screenshot 2024-02-08 at 11 22 53
nshmyrev commented 8 months ago

Yes, partial results are preliminary and not very reliable

matanel-6over6 commented 8 months ago

Is it just the first time? I can count on it the second time and onwards will be [unk]?

matanel-6over6 commented 8 months ago

There is an option to get reliability or score in onPartialResult?

nshmyrev commented 8 months ago

You can find more accurate model, yes! In general it is very hard to spot words in realtime, you'd better have some delay.

matanel-6over6 commented 8 months ago

Thanks a lot

matanel-6over6 commented 8 months ago

Last question, where can I find a more accurate and slimmer model?