evancohen / sonus

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

Add integration layer + IBM Watson support #79

Closed f1yn closed 6 years ago

f1yn commented 6 years ago

Added custom integration hook implementation (including those for websockets), and added support for IBM Watson speech to text service.

I also removed Google Speech as a dependency as it is no longer the only speech engine. The README has also been updated to reflect the new integrations.

I apologize in advance for any formatting errors, my Atom instance uses tabs as the primary tabbing character.

f1yn commented 6 years ago

Just a heads up, while the integration should not break the existing Google Speech one, I have not been able to test if this breaks it or not. As implemented, it shouldn't break it.

ag-ni commented 6 years ago

Wow, Evan, that was a very quick implementation. I am going to try it today. Thanks a lot.

Regards

f1yn commented 6 years ago

@ag-ni I'm not @evancohen but I'm flattered that you'd think I am. The integrations branch (before it's merged) can be installed via npm i flynnham/sonus#feature/integrations.

evancohen commented 6 years ago

At first glance this is awesome! I'll dig into it tonight 👍

ag-ni commented 6 years ago

@flynnham : my bad, I should have checked carefully. But your work is impressive. I am in the process of implementing your version as we speak. Thanks a lot for awesome work. You were really fast. Thank you.

ag-ni commented 6 years ago

@flynnham : Can you please post some instructions how to use your version of Sonus. For example - do we have to install "npm i flynnham/sonus#feature/integrations" on top of Sonus, where do we configure the watson api url , username, password etc. Regards

f1yn commented 6 years ago

@ag-ni There is a simple example on my branch outlining what's required to use the IBM Watson Integration: https://github.com/flynnham/sonus/blob/feature/integrations/examples/watson-example.js

In summary (from the updated README),

const watsonClass = require('watson-developer-cloud/speech-to-text/v1');
const watsonSpeech = new watsonClass({
  "url": "https://stream.watsonplatform.net/speech-to-text/api",
  "username": "<username>",
  "password": "<password>"
})

const speech = require('sonus/integrations').watson(watsonSpeech)

const hotwords = [{ file: 'resources/snowboy.umdl', hotword: 'snowboy' }]
const sonus = Sonus.init({ hotwords }, speech)
ag-ni commented 6 years ago

@flynnham : Thanks a lot for quick response. Yes, indeed you have posted the example.js file already. Actually, I am unable to install, there is an error - npm WARN saveError ENOENT: no such file or directory, open '/home/pi/package.json

Below are my versions of node and npm -- pi@raspberrypi:~ $ node -v v9.2.1 pi@raspberrypi:~ $ npm -v 5.6.0

I am wondering if this needs to be installed on top of sonus ??

Regards

f1yn commented 6 years ago

@ag-ni You need to install it inside of an already existing npm project (using the method I've given above). You also need to install the Watson API in the same project directory with npm i watson-developer-cloud.

evancohen commented 6 years ago

+ @ashishsc What do you think about this approach to support multiple streaming recognizers?

evancohen commented 6 years ago

Ok, so I'm going to be in Peru for the next week and I want @ashishsc to have the chance to review this before I merge. It seems like there's a work-around way to use this in the meantime so I'm inclined to wait until I get back.

@flynnham that sound ok to you?

f1yn commented 6 years ago

@evancohen Sounds good to me.

ag-ni commented 6 years ago

@flynnham : Thanks for the suggestion. I tried to install under existing Sonus directory but I got duplicate error -- npm ERR! code ENOSELF npm ERR! Refusing to install package with name "sonus" under a package npm ERR! also called "sonus". Did you name your project the same npm ERR! as the dependency you're installing?

Any suggestion ? Thank you.

evancohen commented 6 years ago

@ashishsc any chance you'll have time to review sometime this week?

ashishsc commented 6 years ago

Yeah I can review this week. Sorry I've been gone

ashishsc commented 6 years ago

Looks good to me!

evancohen commented 6 years ago

Boom! Thanks folks :)

ag-ni commented 4 years ago

hi @ashishsc @flynnham @evancohen : Seems IBM Watson API has changed/updated. It can not be called by watson-developer-cloud/speech-to-text/v1 Rather it seems that we need to use ibm-watson/speech-to-text/v1

Is there any plant to change the integration / wrapper ?

Regards