Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing example, cleaning up API, and adding language configuration #8

Merged
merged 2 commits into from
Oct 5, 2016

Conversation

evancohen
Copy link
Owner

@ashishsc

Changes:

  • Simplifying interface so users don't have to require('snowboy')
  • ES6ing example
  • Cleaning up README
  • Configuration options for streaming language recognition

@evancohen evancohen reopened this Oct 5, 2016
sonus.mic = {}
const csr = CloudSpeechRecognizer.init(recognizer)

opts.hotwords = opts.hotwords || [1]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's weird that you default to [1]. What's the deal here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this because you want to execute adding the default operation? cause there's cleaner ways to do that

Copy link
Owner Author

@evancohen evancohen Oct 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a 1 line hack so that if someone passes in a blank config object we'll fallback to adding a single default model. When we iterate over the hotwords (in this case a single item array) it will create one for us.
It's the same as:

if(!opts.hotwords){
  models.add({
    file: 'node_modules/snowboy/resources/snowboy.umdl',
    sensitivity: '0.5',
    hotwords : 'default'
  })
} else {
  opts.hotwords.forEach(model => {
    models.add({
      file: model.file || 'node_modules/snowboy/resources/snowboy.umdl',
      sensitivity: model.sensitivity || '0.5',
      hotwords : model.hotword || 'default'
    })
  })
}

We could probably do better error handling here... But let's do that when writing the tests?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you propose?

```

Create your own Alexa in less than 10 lines of code:
Create your own Alexa in less than a tweet:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

damn straight

const opts = Object.assign({}, options)

const sonus = new stream.Writable()
const opts = Object.assign({}, options),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does object.assign copy nested props?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

> let obj = {foo : {bar : 'bash'}, hi : 'mom'}
undefined
> let obj2 = Object.assign({}, obj)
undefined
> console.log(obj2)
{ foo: { bar: 'bash' }, hi: 'mom' }

Copy link
Collaborator

@ashishsc ashishsc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the [1] awkwardness.

@ashishsc
Copy link
Collaborator

ashishsc commented Oct 5, 2016

Plenty of things, do while, a small function, even an object literal
instead of a one works better

On Tue, Oct 4, 2016, 10:41 PM Evan Cohen notifications@github.com wrote:

@evancohen commented on this pull request.

In index.js #8:

sonus.mic = {}

  • const csr = CloudSpeechRecognizer.init(recognizer)
  • opts.hotwords = opts.hotwords || [1]

What do you propose?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#8, or mute the thread
https://github.com/notifications/unsubscribe-auth/ACgRCpKnJXMjeK-vw_l4qqXTn4aj1VBnks5qwzhsgaJpZM4KOabL
.

@evancohen evancohen merged commit 81c06b4 into master Oct 5, 2016
@ashishsc
Copy link
Collaborator

ashishsc commented Oct 5, 2016

⛓️ saw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants