Skip to content

Commit 6f39cb4

Browse files
speech: update to v1 (#2175)
1 parent 65b0660 commit 6f39cb4

File tree

12 files changed

+481
-316
lines changed

12 files changed

+481
-316
lines changed

.jscsrc

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
"allowUrlComments": true
2121
},
2222
"excludeFiles": [
23-
"system-test/data/*",
24-
"test/testdata/*",
23+
"**/src/*/**/*",
24+
"**/system-test/*/**/*",
25+
"**/test/*/**/*",
2526
"**/node_modules/"
2627
]
2728
}

.jshintignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
**/system-test/data/*
2-
**/test/testdata/*
1+
**/src/*/**/*
2+
**/system-test/*/**/*
3+
**/test/*/**/*
34
**/node_modules/

README.md

+3-23
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ var speechClient = speech({
997997
// Detect the speech in an audio file.
998998
speechClient.recognize('./audio.raw', {
999999
encoding: 'LINEAR16',
1000-
sampleRate: 16000
1000+
sampleRateHertz: 16000
10011001
}, function(err, transcript) {
10021002
// transcript = 'how old is the Brooklyn Bridge'
10031003
});
@@ -1008,34 +1008,14 @@ fs.createReadStream('./audio.raw')
10081008
.pipe(speechClient.createRecognizeStream({
10091009
config: {
10101010
encoding: 'LINEAR16',
1011-
sampleRate: 16000
1011+
sampleRateHertz: 16000
10121012
},
10131013
singleUtterance: false,
10141014
interimResults: false
10151015
}))
10161016
.on('error', console.error)
10171017
.on('data', function(data) {
1018-
// The first "data" event emitted might look like:
1019-
// data = {
1020-
// endpointerType: Speech.endpointerTypes.START_OF_SPEECH,
1021-
// results: "",
1022-
// ...
1023-
// }
1024-
//
1025-
// A later "data" event emitted might look like:
1026-
// data = {
1027-
// endpointerType: Speech.endpointerTypes.END_OF_AUDIO,
1028-
// results: "",
1029-
// ...
1030-
// }
1031-
//
1032-
// A final "data" event emitted might look like:
1033-
// data = {
1034-
// endpointerType:
1035-
// Speech.endpointerTypes.ENDPOINTER_EVENT_UNSPECIFIED,
1036-
// results: "how old is the Brooklyn Bridge",
1037-
// ...
1038-
// }
1018+
// data.results = "how old is the Brooklyn Bridge"
10391019
});
10401020
```
10411021

packages/speech/README.md

+4-21
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var speech = require('@google-cloud/speech')({
1919
// Detect the speech in an audio file.
2020
speech.recognize('./audio.raw', {
2121
encoding: 'LINEAR16',
22-
sampleRate: 16000
22+
sampleRateHertz: 16000
2323
}, function(err, transcript) {
2424
// transcript = 'how old is the Brooklyn Bridge'
2525
});
@@ -30,37 +30,20 @@ fs.createReadStream('./audio.raw')
3030
.pipe(speech.createRecognizeStream({
3131
config: {
3232
encoding: 'LINEAR16',
33-
sampleRate: 16000
33+
sampleRateHertz: 16000
3434
},
3535
singleUtterance: false,
3636
interimResults: false
3737
}))
3838
.on('error', console.error)
3939
.on('data', function(data) {
40-
// The first "data" event emitted might look like:
41-
// data = {
42-
// endpointerType: Speech.endpointerTypes.START_OF_SPEECH,
43-
// ...
44-
// }
45-
//
46-
// A later "data" event emitted might look like:
47-
// data = {
48-
// endpointerType: Speech.endpointerTypes.END_OF_AUDIO,
49-
// ...
50-
// }
51-
//
52-
// A final "data" event emitted might look like:
53-
// data = {
54-
// endpointerType: Speech.endpointerTypes.END_OF_AUDIO,
55-
// results: "how old is the Brooklyn Bridge",
56-
// ...
57-
// }
40+
// data.results = "how old is the Brooklyn Bridge"
5841
});
5942

6043
// Promises are also supported by omitting callbacks.
6144
speech.recognize('./audio.raw', {
6245
encoding: 'LINEAR16',
63-
sampleRate: 16000
46+
sampleRateHertz: 16000
6447
}).then(function(data) {
6548
var transcript = data[0];
6649
});

packages/speech/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858
"@google-cloud/common-grpc": "^0.3.0",
5959
"events-intercept": "^2.0.0",
6060
"extend": "^3.0.0",
61-
"google-gax": "^0.12.0",
62-
"google-proto-files": "^0.10.0",
61+
"google-gax": "^0.12.3",
62+
"google-proto-files": "^0.11.0",
6363
"is": "^3.1.0",
6464
"propprop": "^0.3.1",
6565
"pumpify": "^1.3.5",

0 commit comments

Comments
 (0)