Skip to content

Commit

Permalink
speech: update to v1 (googleapis#2175)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenplusplus authored Apr 3, 2017
1 parent 65b0660 commit 6f39cb4
Show file tree
Hide file tree
Showing 12 changed files with 481 additions and 316 deletions.
5 changes: 3 additions & 2 deletions .jscsrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
"allowUrlComments": true
},
"excludeFiles": [
"system-test/data/*",
"test/testdata/*",
"**/src/*/**/*",
"**/system-test/*/**/*",
"**/test/*/**/*",
"**/node_modules/"
]
}
5 changes: 3 additions & 2 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/system-test/data/*
**/test/testdata/*
**/src/*/**/*
**/system-test/*/**/*
**/test/*/**/*
**/node_modules/
26 changes: 3 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ var speechClient = speech({
// Detect the speech in an audio file.
speechClient.recognize('./audio.raw', {
encoding: 'LINEAR16',
sampleRate: 16000
sampleRateHertz: 16000
}, function(err, transcript) {
// transcript = 'how old is the Brooklyn Bridge'
});
Expand All @@ -1008,34 +1008,14 @@ fs.createReadStream('./audio.raw')
.pipe(speechClient.createRecognizeStream({
config: {
encoding: 'LINEAR16',
sampleRate: 16000
sampleRateHertz: 16000
},
singleUtterance: false,
interimResults: false
}))
.on('error', console.error)
.on('data', function(data) {
// The first "data" event emitted might look like:
// data = {
// endpointerType: Speech.endpointerTypes.START_OF_SPEECH,
// results: "",
// ...
// }
//
// A later "data" event emitted might look like:
// data = {
// endpointerType: Speech.endpointerTypes.END_OF_AUDIO,
// results: "",
// ...
// }
//
// A final "data" event emitted might look like:
// data = {
// endpointerType:
// Speech.endpointerTypes.ENDPOINTER_EVENT_UNSPECIFIED,
// results: "how old is the Brooklyn Bridge",
// ...
// }
// data.results = "how old is the Brooklyn Bridge"
});
```

Expand Down
25 changes: 4 additions & 21 deletions packages/speech/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var speech = require('@google-cloud/speech')({
// Detect the speech in an audio file.
speech.recognize('./audio.raw', {
encoding: 'LINEAR16',
sampleRate: 16000
sampleRateHertz: 16000
}, function(err, transcript) {
// transcript = 'how old is the Brooklyn Bridge'
});
Expand All @@ -30,37 +30,20 @@ fs.createReadStream('./audio.raw')
.pipe(speech.createRecognizeStream({
config: {
encoding: 'LINEAR16',
sampleRate: 16000
sampleRateHertz: 16000
},
singleUtterance: false,
interimResults: false
}))
.on('error', console.error)
.on('data', function(data) {
// The first "data" event emitted might look like:
// data = {
// endpointerType: Speech.endpointerTypes.START_OF_SPEECH,
// ...
// }
//
// A later "data" event emitted might look like:
// data = {
// endpointerType: Speech.endpointerTypes.END_OF_AUDIO,
// ...
// }
//
// A final "data" event emitted might look like:
// data = {
// endpointerType: Speech.endpointerTypes.END_OF_AUDIO,
// results: "how old is the Brooklyn Bridge",
// ...
// }
// data.results = "how old is the Brooklyn Bridge"
});

// Promises are also supported by omitting callbacks.
speech.recognize('./audio.raw', {
encoding: 'LINEAR16',
sampleRate: 16000
sampleRateHertz: 16000
}).then(function(data) {
var transcript = data[0];
});
Expand Down
4 changes: 2 additions & 2 deletions packages/speech/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
"@google-cloud/common-grpc": "^0.3.0",
"events-intercept": "^2.0.0",
"extend": "^3.0.0",
"google-gax": "^0.12.0",
"google-proto-files": "^0.10.0",
"google-gax": "^0.12.3",
"google-proto-files": "^0.11.0",
"is": "^3.1.0",
"propprop": "^0.3.1",
"pumpify": "^1.3.5",
Expand Down
Loading

0 comments on commit 6f39cb4

Please sign in to comment.