evancohen / sonus

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

Can we use mutil hotword with different callback? #55

Open jackynguyen93 opened 6 years ago

jackynguyen93 commented 6 years ago

I see that Snowboy can use mutil model and each model have their callback. Does Sonus can do the same?

evancohen commented 6 years ago

In a round-about way, yes. Sonus doesn't surface the last hotword with final results of an utterance, but you could do something like:


let lastKeyword = null

sonus.on('hotword', (index, keyword) => {
    lastKeyword = keyword
})

sonus.on('final-result', result => {
    if(lastKeyword == 'something'){
        //do something
    } else {
        //some other logic
    }
})