evancohen / sonus

:speech_balloon: /so.nus/ STT (speech to text) for Node with offline hotword detection
MIT License
625 stars 79 forks source link

Continus recognition #18

Closed buildog closed 7 years ago

buildog commented 7 years ago

Great implementation, very instructive :-)

I'm wondering what would be the best implementation to keep speech recognition after a first hotword, which is mostly the case on a conversationnal boot, user won't say everytime the hotword, dosen't make sense.

The problem there is that sonus trigger the intent processing after the final-result emitted at the end of recognitionStream, so we need a way to manualy trigger the hotword in order to avoid a painfull repeat for the user.

Maybe a const detector > sonus.detector ?

evancohen commented 7 years ago

I think this is a good idea. I see two options:

Add a trigger API that would simulate speaking a hotword and start streaming. Possibly something like:

Sonus(sonus).trigger()

And/or an option that gets passed into the constructor that triggers recognition after a hotword is detected until the is no more speech.

I think that both of these options would be useful for their own use cases so I'm inclined to implement both. My only concern is with the support of other recognition engines for a "continuous" mode. Would having only the first option work for you? If so I think I can take a crack at it over the weekend.

buildog commented 7 years ago

yeah a trigger api should do the job :-)

buildog commented 7 years ago
if (data.endpointerType === 'END_OF_AUDIO') {
    sonus.emit('end-of-recognition')
}

may be usefull too