watson-developer-cloud / node-sdk

:comet: Node.js library to access IBM Watson services.
https://www.npmjs.com/package/ibm-watson
Apache License 2.0
1.48k stars 669 forks source link

[speech-to-text] handle Edge case: zero result entries. #198

Closed monte-hayward closed 8 years ago

monte-hayward commented 8 years ago

Can occur when a pipeline sends a chunk of audio that is silent.

nfriedly commented 8 years ago

Thanks, good catch. I fixed it and added a test.

Question for you (and @germanattanasio and @jsstylos): What do you expect the stream to output for a silent audio file: no data events at all, or at least one data event with an empty string?

(I just copied in your fix which results in no data events at all but my initial test had it failing still because I copped the previous test but had it expecting an empty string instead of some text - I rewrote the test so that it now will pass either way: it's happy as long as there are no data events with truthy values.)

UPDATE: I talked to some folks on the #Node.js IRC and they seem to agree that the current solution (no data events) is preferable.

nfriedly commented 8 years ago

Oh, and sorry @monte-hayward - I started looking at this after your first commit and didn't realize that you were also working on a test. It looks like yours is going to be more comprehensive than mine, so we'll go ahead and merge it in once you're ready. One of us will just have to deal with the conflicts.

germanattanasio commented 8 years ago

@monte-hayward thanks for your contribution!