sonus icon indicating copy to clipboard operation
sonus copied to clipboard

Can we use mutil hotword with different callback?

Open jackynguyen93 opened this issue 6 years ago • 1 comments

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

jackynguyen93 avatar Aug 12 '17 14:08 jackynguyen93

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
    }
})

evancohen avatar Aug 15 '17 18:08 evancohen