Skip to content

chore: upgrade speech samples to new surface #1887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions speech/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require": {
"google/cloud-speech": "^1.0.0",
"google/cloud-storage": "^1.20.1"
"google/cloud-speech": "^1.16",
"google/cloud-storage": "^1.36"
}
}
2 changes: 1 addition & 1 deletion speech/quickstart.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
require __DIR__ . '/vendor/autoload.php';

# Imports the Google Cloud client library
use Google\Cloud\Speech\V1\SpeechClient;
use Google\Cloud\Speech\V1\RecognitionAudio;
use Google\Cloud\Speech\V1\RecognitionConfig;
use Google\Cloud\Speech\V1\RecognitionConfig\AudioEncoding;
use Google\Cloud\Speech\V1\SpeechClient;

# The name of the audio file to transcribe
$gcsURI = 'gs://cloud-samples-data/speech/brooklyn_bridge.raw';
Expand Down
2 changes: 1 addition & 1 deletion speech/src/multi_region_gcs.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

# [START speech_transcribe_with_multi_region_gcs]
# Imports the Google Cloud client library
use Google\Cloud\Speech\V1\SpeechClient;
use Google\Cloud\Speech\V1\RecognitionAudio;
use Google\Cloud\Speech\V1\RecognitionConfig;
use Google\Cloud\Speech\V1\RecognitionConfig\AudioEncoding;
use Google\Cloud\Speech\V1\SpeechClient;

/**
* @param string $uri The Cloud Storage object to transcribe
Expand Down
2 changes: 1 addition & 1 deletion speech/src/profanity_filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
namespace Google\Cloud\Samples\Speech;

# [START speech_profanity_filter]
use Google\Cloud\Speech\V1\SpeechClient;
use Google\Cloud\Speech\V1\RecognitionAudio;
use Google\Cloud\Speech\V1\RecognitionConfig;
use Google\Cloud\Speech\V1\RecognitionConfig\AudioEncoding;
use Google\Cloud\Speech\V1\SpeechClient;

/**
* @param string $audioFile path to an audio file
Expand Down
2 changes: 1 addition & 1 deletion speech/src/profanity_filter_gcs.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
namespace Google\Cloud\Samples\Speech;

# [START speech_profanity_filter_gcs]
use Google\Cloud\Speech\V1\SpeechClient;
use Google\Cloud\Speech\V1\RecognitionAudio;
use Google\Cloud\Speech\V1\RecognitionConfig;
use Google\Cloud\Speech\V1\RecognitionConfig\AudioEncoding;
use Google\Cloud\Speech\V1\SpeechClient;

/**
* @param string $uri The Cloud Storage object to transcribe (gs://your-bucket-name/your-object-name)
Expand Down
4 changes: 2 additions & 2 deletions speech/src/streaming_recognize.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
namespace Google\Cloud\Samples\Speech;

# [START speech_transcribe_streaming]
use Google\Cloud\Speech\V1\SpeechClient;
use Google\Cloud\Speech\V1\RecognitionConfig;
use Google\Cloud\Speech\V1\RecognitionConfig\AudioEncoding;
use Google\Cloud\Speech\V1\SpeechClient;
use Google\Cloud\Speech\V1\StreamingRecognitionConfig;
use Google\Cloud\Speech\V1\StreamingRecognizeRequest;
use Google\Cloud\Speech\V1\RecognitionConfig\AudioEncoding;

/**
* @param string $audioFile path to an audio file
Expand Down
2 changes: 1 addition & 1 deletion speech/src/transcribe_async.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
namespace Google\Cloud\Samples\Speech;

# [START speech_transcribe_async]
use Google\Cloud\Speech\V1\SpeechClient;
use Google\Cloud\Speech\V1\RecognitionAudio;
use Google\Cloud\Speech\V1\RecognitionConfig;
use Google\Cloud\Speech\V1\RecognitionConfig\AudioEncoding;
use Google\Cloud\Speech\V1\SpeechClient;

/**
* @param string $audioFile path to an audio file
Expand Down
2 changes: 1 addition & 1 deletion speech/src/transcribe_async_gcs.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
namespace Google\Cloud\Samples\Speech;

# [START speech_transcribe_async_gcs]
use Google\Cloud\Speech\V1\SpeechClient;
use Google\Cloud\Speech\V1\RecognitionAudio;
use Google\Cloud\Speech\V1\RecognitionConfig;
use Google\Cloud\Speech\V1\RecognitionConfig\AudioEncoding;
use Google\Cloud\Speech\V1\SpeechClient;

/**
* @param string $uri The Cloud Storage object to transcribe (gs://your-bucket-name/your-object-name)
Expand Down
2 changes: 1 addition & 1 deletion speech/src/transcribe_async_words.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
namespace Google\Cloud\Samples\Speech;

# [START speech_transcribe_async_word_time_offsets_gcs]
use Google\Cloud\Speech\V1\SpeechClient;
use Google\Cloud\Speech\V1\RecognitionAudio;
use Google\Cloud\Speech\V1\RecognitionConfig;
use Google\Cloud\Speech\V1\RecognitionConfig\AudioEncoding;
use Google\Cloud\Speech\V1\SpeechClient;

/**
* @param string $audioFile path to an audio file
Expand Down
2 changes: 1 addition & 1 deletion speech/src/transcribe_auto_punctuation.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
namespace Google\Cloud\Samples\Speech;

# [START speech_transcribe_auto_punctuation]
use Google\Cloud\Speech\V1\SpeechClient;
use Google\Cloud\Speech\V1\RecognitionAudio;
use Google\Cloud\Speech\V1\RecognitionConfig;
use Google\Cloud\Speech\V1\RecognitionConfig\AudioEncoding;
use Google\Cloud\Speech\V1\SpeechClient;

/**
* @param string $audioFile path to an audio file
Expand Down
2 changes: 1 addition & 1 deletion speech/src/transcribe_enhanced_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
namespace Google\Cloud\Samples\Speech;

# [START speech_transcribe_enhanced_model]
use Google\Cloud\Speech\V1\SpeechClient;
use Google\Cloud\Speech\V1\RecognitionAudio;
use Google\Cloud\Speech\V1\RecognitionConfig;
use Google\Cloud\Speech\V1\RecognitionConfig\AudioEncoding;
use Google\Cloud\Speech\V1\SpeechClient;

/**
* @param string $audioFile path to an audio file
Expand Down
2 changes: 1 addition & 1 deletion speech/src/transcribe_model_selection.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
namespace Google\Cloud\Samples\Speech;

# [START speech_transcribe_model_selection]
use Google\Cloud\Speech\V1\SpeechClient;
use Google\Cloud\Speech\V1\RecognitionAudio;
use Google\Cloud\Speech\V1\RecognitionConfig;
use Google\Cloud\Speech\V1\RecognitionConfig\AudioEncoding;
use Google\Cloud\Speech\V1\SpeechClient;

/**
* @param string $audioFile path to an audio file
Expand Down
2 changes: 1 addition & 1 deletion speech/src/transcribe_sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
namespace Google\Cloud\Samples\Speech;

# [START speech_transcribe_sync]
use Google\Cloud\Speech\V1\SpeechClient;
use Google\Cloud\Speech\V1\RecognitionAudio;
use Google\Cloud\Speech\V1\RecognitionConfig;
use Google\Cloud\Speech\V1\RecognitionConfig\AudioEncoding;
use Google\Cloud\Speech\V1\SpeechClient;

/**
* @param string $audioFile path to an audio file
Expand Down
2 changes: 1 addition & 1 deletion speech/src/transcribe_sync_gcs.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
namespace Google\Cloud\Samples\Speech;

# [START speech_transcribe_sync_gcs]
use Google\Cloud\Speech\V1\SpeechClient;
use Google\Cloud\Speech\V1\RecognitionAudio;
use Google\Cloud\Speech\V1\RecognitionConfig;
use Google\Cloud\Speech\V1\RecognitionConfig\AudioEncoding;
use Google\Cloud\Speech\V1\SpeechClient;

/**
* @param string $uri The Cloud Storage object to transcribe (gs://your-bucket-name/your-object-name)
Expand Down
2 changes: 1 addition & 1 deletion speech/test/quickstartTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
use PHPUnit\Framework\TestCase;
use Google\Cloud\TestUtils\TestTrait;
use PHPUnit\Framework\TestCase;

class quickstartTest extends TestCase
{
Expand Down