Skip to content

Commit f3cbdb6

Browse files
feat: update parameter names in recognize/synthesize streams to… (#151)
feat: update parameter names in recognize/synthesize streams to be lower camel case
2 parents 9795456 + 10a3ff1 commit f3cbdb6

18 files changed

+385
-334
lines changed

Diff for: CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
### v0.37.0
4+
* BREAKING CHANGES INTRODUCED:
5+
* All options parameters for all methods are coverted to be lowerCamelCase
6+
* For example: `access_token` is now `accessToken` and `content-type` is now `contentType`
7+
* Response data from the service is not affected by this change
8+
39
### v0.34.0
410
* Add support for guessing .mp3 (via file name & header) & .webm (via filename) content-types
511
* Re-factored content-type guessing to check filename first, and file header second

Diff for: examples/server.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ app.use('/api/speech-to-text/token', function(req, res) {
9494
}
9595
const token = response.token || response;
9696
if (process.env.SPEECH_TO_TEXT_IAM_APIKEY) {
97-
res.json({ access_token: token, url: sttCredentials.url });
97+
res.json({ accessToken: token, url: sttCredentials.url });
9898
} else {
9999
res.json({ token: token, url: sttCredentials.url });
100100
}
@@ -121,7 +121,7 @@ app.use('/api/text-to-speech/token', function(req, res) {
121121
}
122122
const token = response.token || response;
123123
if (process.env.TEXT_TO_SPEECH_IAM_APIKEY) {
124-
res.json({ access_token: token, url: ttsCredentials.url });
124+
res.json({ accessToken: token, url: ttsCredentials.url });
125125
} else {
126126
res.json({ token: token, url: ttsCredentials.url });
127127
}

Diff for: examples/static/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ <h3>File Input</h3>
3232
<ul>
3333
<li><a href="file-url.html">Transcribe and Play a file via URL, with pre-loaded token (compatible with iOS)</a></li>
3434
<li><a href="file-upload.html">Transcribe and Play a user-provided file</a></li>
35-
<li><a href="speaker-labels-file-console.html">Transcribe from URL with <code>{speaker_labels: true}</code>, output to console</a></li>
35+
<li><a href="speaker-labels-file-console.html">Transcribe from URL with <code>{speakerLabels: true}</code>, output to console</a></li>
3636
<li><a href="speaker-stream-file-console.html">Transcribe from URL with <code>{resultsBySpeaker: true}</code>, output to console</a></li>
3737
<li><a href="speaker-stream-file-html.html">Transcribe from URL with <code>{resultsBySpeaker: true}</code>, output HTML</a></li>
3838
<li><a href="realtime-vs-no-realtime.html">Compare <code>realtime</code> and <code>TimingStream</code> options</a></li>

Diff for: examples/static/microphone-alternatives.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ <h2>Code for this demo:</h2>
3838

3939
var stream = WatsonSpeech.SpeechToText.recognizeMicrophone(Object.assign(token, {
4040
objectMode: true,
41-
max_alternatives: 4
41+
maxAlternatives: 4
4242
}));
4343

4444
stream.on('error', function(err) {

Diff for: examples/static/microphone-streaming-text-to-console.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ <h2>Code for this demo:</h2>
3434
}).then(function (token) {
3535

3636
var stream = WatsonSpeech.SpeechToText.recognizeMicrophone(Object.assign(token, {
37-
object_mode: false
37+
objectMode: false
3838
}));
3939

4040
stream.setEncoding('utf8'); // get text instead of Buffers for on data events

Diff for: examples/static/microphone-word-confidence.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ <h2>Code for this demo:</h2>
4646
var stream = WatsonSpeech.SpeechToText.recognizeMicrophone(Object.assign(token, {
4747
objectMode: true,
4848
format: false,
49-
word_confidence: true
49+
wordConfidence: true
5050
}));
5151

5252
stream.on('error', function(err) {

Diff for: examples/static/speaker-labels-file-console.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ <h2>Code for this demo:</h2>
3535
.then(function(token) {
3636
var stream = WatsonSpeech.SpeechToText.recognizeFile(Object.assign(token, {
3737
file: '/en-us-multi-speaker-narrowband.wav',
38-
speaker_labels: true,
38+
speakerLabels: true,
3939
// only certain models support speaker labels currently,
4040
// see https://console.bluemix.net/docs/services/speech-to-text/output.html#output
4141
model: 'en-US_NarrowbandModel',

Diff for: examples/static/speaker-stream-file-html.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ <h2>Code for this demo:</h2>
3737

3838
var stream = WatsonSpeech.SpeechToText.recognizeFile(Object.assign(token, {
3939
file: '/en-us-multi-speaker-narrowband.wav',
40-
speaker_labels: true,
40+
speakerLabels: true,
4141
// only certain models support speaker labels currently,
4242
// see https://console.bluemix.net/docs/services/speech-to-text/output.html#output
4343
model: 'en-US_NarrowbandModel',

0 commit comments

Comments
 (0)