Module: Google::Cloud::Speech
- Defined in:
- lib/google/cloud/speech.rb,
lib/google/cloud/speech/v1.rb,
lib/google/cloud/speech/audio.rb,
lib/google/cloud/speech/result.rb,
lib/google/cloud/speech/stream.rb,
lib/google/cloud/speech/convert.rb,
lib/google/cloud/speech/project.rb,
lib/google/cloud/speech/service.rb,
lib/google/cloud/speech/version.rb,
lib/google/cloud/speech/operation.rb,
lib/google/cloud/speech/credentials.rb,
lib/google/cloud/speech/v1/doc/overview.rb,
lib/google/cloud/speech/v1/speech_client.rb,
lib/google/cloud/speech/v1/cloud_speech_pb.rb,
lib/google/cloud/speech/v1/cloud_speech_services_pb.rb,
lib/google/cloud/speech/v1/doc/google/cloud/speech/v1/cloud_speech.rb
Overview
Ruby Client for Google Cloud Speech API (Alpha)
Google Cloud Speech API: Google Cloud Speech API.
Quick Start
In order to use this library, you first need to go through the following steps:
- Select or create a Cloud Platform project.
- Enable billing for your project.
- Enable the Google Cloud Speech API.
- Setup Authentication.
Installation
$ gem install google-cloud-speech
Preview
SpeechClient
require "google/cloud/speech"
speech_client = Google::Cloud::Speech.new
language_code = "en-US"
sample_rate_hertz = 44100
encoding = :FLAC
config = {
language_code: language_code,
sample_rate_hertz: sample_rate_hertz,
encoding: encoding
}
uri = "gs://gapic-toolkit/hello.flac"
audio = { uri: uri }
response = speech_client.recognize(config, audio)
Next Steps
- Read the Google Cloud Speech API Product documentation to learn more about the product and see How-to Guides.
- View this repository's main README to see the full list of Cloud APIs that we cover.
Defined Under Namespace
Modules: V1 Classes: Audio, Credentials, InterimResult, Operation, Project, Result, Stream
Constant Summary collapse
- VERSION =
"0.28.0"
Class Method Summary collapse
-
.new(project_id: nil, credentials: nil, scope: nil, timeout: nil, client_config: nil, project: nil, keyfile: nil) ⇒ Google::Cloud::Speech::Project
Creates a new object for connecting to the Speech service.
Class Method Details
.new(project_id: nil, credentials: nil, scope: nil, timeout: nil, client_config: nil, project: nil, keyfile: nil) ⇒ Google::Cloud::Speech::Project
Creates a new object for connecting to the Speech service. Each call creates a new connection.
For more information on connecting to Google Cloud see the Authentication Guide.
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/google/cloud/speech.rb', line 225 def self.new project_id: nil, credentials: nil, scope: nil, timeout: nil, client_config: nil, project: nil, keyfile: nil project_id ||= (project || Speech::Project.default_project_id) project_id = project_id.to_s # Always cast to a string fail ArgumentError, "project_id is missing" if project_id.empty? credentials ||= (keyfile || Speech::Credentials.default(scope: scope)) unless credentials.is_a? Google::Auth::Credentials credentials = Speech::Credentials.new credentials, scope: scope end Speech::Project.new( Speech::Service.new( project_id, credentials, timeout: timeout, client_config: client_config)) end |