Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Code Samples for new v1p1beta1 features #118

Merged
merged 53 commits into from
Jul 31, 2018

Conversation

CallistoCF
Copy link
Contributor

@CallistoCF CallistoCF commented Jul 17, 2018

Code Samples for new features added to v1p1beta1 endpoint

const speech = require('@google-cloud/speech').v1p1beta1;
const client = new speech.SpeechClient();

Canonical Beta Samples: Python, Java (PR)

Speaker Diarization

  • speech_transcribe_diarization
  • speech_transcribe_diarization_gcs

Multi-Channel Audio

  • speech_transcribe_multichannel
  • speech_transcribe_multichannel_gcs

Multi-Language

  • speech_transcribe_multilang
  • speech_transcribe_multilang_gcs

Word-Level Confidence

  • speech_transcribe_word_level_confidence
  • speech_transcribe_word_level_confidence_gcs

Tasks

  • Tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@googlebot googlebot added the cla: no This human has *not* signed the Contributor License Agreement. label Jul 17, 2018
@ghost ghost assigned JustinBeckwith Jul 17, 2018
@codecov
Copy link

codecov bot commented Jul 17, 2018

Codecov Report

Merging #118 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #118   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           2      2           
  Lines          34     34           
=====================================
  Hits           34     34

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 22246e5...7cf0fa3. Read the comment docs.


// const defaultStereoURI =
// 'gs://cloud-samples-tests/speech/commercial_stereo.wav';
const gnome = `/Users/cfrater/SPEECH3/nodejs-speech/samples/resources/Google_Gnome.wav`;

This comment was marked as spam.

`multiChannelTranscribe`,
`Differentiates input by audio channel in local audio file.`,
{},
opts => speechTranscribeMultiChannel(opts.speechFileGnome)

This comment was marked as spam.

`multiChannelTranscribeGCS`,
`Differentiates input by audio channel from GCS audio file.`,
{},
opts => speechTranscribeMultichannelGCS(opts.gcsUriStereo)

This comment was marked as spam.

This comment was marked as spam.

encoding: `LINEAR16`,
sampleRateHertz: 16000,
languageCode: `en-US`,
audioChannelCount: 1,

This comment was marked as spam.

sampleRateHertz: 44100,
languageCode: `en-US`,
alternativeLanguageCodes: [`es-ES`, `en-US`],
audioChannelCount: 2,

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

encoding: `FLAC`,
sampleRateHertz: 16000,
languageCode: `en-US`,
enableWordTimeOffsets: true,

This comment was marked as spam.

This comment was marked as spam.

@@ -0,0 +1,82 @@
// /**
// * Copyright 2016, Google, Inc.

This comment was marked as spam.

This comment was marked as spam.

@@ -0,0 +1,608 @@
/**
* Copyright 2017, Google, Inc.

This comment was marked as spam.

audio: audio,
};

// client

This comment was marked as spam.

This comment was marked as spam.


// Creates a client
const client = new speech.SpeechClient();

This comment was marked as spam.

This comment was marked as spam.


const fs = require('fs');
const speech = require('@google-cloud/speech').v1p1beta1;

This comment was marked as spam.

This comment was marked as spam.


// Creates a client
const client = new speech.SpeechClient();

This comment was marked as spam.


// Creates a client
const client = new speech.SpeechClient();

This comment was marked as spam.

This comment was marked as spam.


// Creates a client
const client = new speech.SpeechClient();

This comment was marked as spam.


// Creates a client
const client = new speech.SpeechClient();

This comment was marked as spam.

This comment was marked as spam.

// [END speechTranscribeWordLevelConfidence]
}

function speechTranscribeWordLevelConfidenceGCS(gcsUri) {

This comment was marked as spam.

This comment was marked as spam.

@beccasaurus beccasaurus added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Jul 20, 2018
@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@googlebot googlebot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Jul 20, 2018
// [START speech_transcribe_multilanguage]

const fs = require('fs');
const speech = require('@google-cloud/speech').v1p1beta1;

This comment was marked as spam.

// [END speech_transcribe_word_level_confidence_gcs]
}

//audio file paths for Defaults

This comment was marked as spam.

This comment was marked as spam.

const output = await runAsync(`${cmd} wordLevelConfidenceGCS`, cwd);
t.true(
output.includes(`Transcription: how old is the Brooklyn Bridge`) &&
output.includes(`Confidence: 0.9836039543151855`)

This comment was marked as spam.

This comment was marked as spam.

@@ -13,6 +13,8 @@
* limitations under the License.
*/

/* eslint-disable */

This comment was marked as spam.

@@ -13,6 +13,8 @@
* limitations under the License.
*/

/* eslint-disable */

This comment was marked as spam.

@@ -13,6 +13,8 @@
* limitations under the License.
*/

/* eslint-disable */

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

Copy link
Contributor

@beccasaurus beccasaurus left a comment

Choose a reason for hiding this comment

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

Overview of things to fix:

  • remove various extraneous newlines
  • fix 1 missing comment on client library comment
  • explain why eslint has been disabled on various otherwise unchanged files or re-enable eslint on these files (see comment)
  • regenerate scaffolding (there is one comment from jerjou re: 'FLAC' which I think simply needs a regen)
  • reply to jerjou's question about formatting
  • add multi-channel GCS back or reply to jerjou's comment with why you are not adding it back
  • reply to my comment about CLI default files (remove this code if there is no existing precedent for it)
  • fix text to not check for exact confidence

These all have existing comments. Thanks!

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

--multiSpeechFile, --ms [string] [default: "./resources/multi.wav"]
--multiSpeechUri, --msu [string] [default: "gs://cloud-samples-tests/speech/multi.wav"]
--speechFileStereo, --fs [string] [default: "./samples/resources/commercial_stereo.wav"]
--brooklynBridgeSpeechFile, --bb

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@@ -0,0 +1,14 @@
{

This comment was marked as spam.

This comment was marked as spam.

@beccasaurus beccasaurus added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Jul 31, 2018
@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

@beccasaurus beccasaurus merged commit 06b3ec7 into googleapis:master Jul 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants