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.7k stars 1.08k forks source link

The issue with a fixed vocabulary #1306

Open project-owner opened 1 year ago

project-owner commented 1 year ago

Hi,

I've modified the example test_microphone.py by adding a fixed vocabulary with just one word 'start':

.....
    vocabulary = '["start", "[unk]"]'
    .....
        rec = KaldiRecognizer(model, args.samplerate, vocabulary)
.....

It works fine when I say 'start'. But it shows 'start' even when I say 'stop'. Am I missing anything here?

Thank you!

nshmyrev commented 1 year ago

Please share an audio file to reproduce the issue.

In general start and stop are pretty similar, it is easy to confuse them

project-owner commented 1 year ago

You are probably right. I'm using a small model. Would a big model help here? This is test_microphone.py. There is no audio file. Usually I use translate.google.com, speaker and mike next to a speaker.

Thank you!

nshmyrev commented 1 year ago

test_microphone has -f option to store an audio file

project-owner commented 1 year ago

OK, here is the source with fixed vocabulary (start): https://raw.githubusercontent.com/project-owner/Peppy.doc/master/files/test_mic.py here is the output with 'stop': https://github.com/project-owner/Peppy.doc/raw/master/files/test-mic.wav

Thank you!

ilyamiro commented 7 months ago

@nshmyrev Hello, i was doing the same case and, i wondered: can i set a vocabulary to normal again? for example, i have a recognizer using fixes vocabulary, but then in some place in my program i would need it to use all the words again. How can i "reset" the recognizer?

nshmyrev commented 7 months ago

@ilyamiro you simply create new recognizer, it is fast.