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/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 the Google Cloud Speech API.
- Setup Authentication.
Installation
$ gem install google-cloud-speech
Preview
SpeechClient
require "google/cloud/speech/v1"
speech_client = Google::Cloud::Speech::V1::SpeechClient.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, InterimResult, Operation, Project, Result, Stream
Constant Summary collapse
- VERSION =
"0.26.0"
Class Method Summary collapse
-
.new(project: nil, keyfile: nil, scope: nil, timeout: nil, client_config: nil) ⇒ Google::Cloud::Speech::Project
Creates a new object for connecting to the Speech service.
Class Method Details
.new(project: nil, keyfile: nil, scope: nil, timeout: nil, client_config: 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.
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
# File 'lib/google/cloud/speech.rb', line 222 def self.new project: nil, keyfile: nil, scope: nil, timeout: nil, client_config: nil project ||= Google::Cloud::Speech::Project.default_project project = project.to_s # Always cast to a string fail ArgumentError, "project is missing" if project.empty? if keyfile.nil? credentials = Google::Cloud::Speech::Credentials.default scope: scope else credentials = Google::Cloud::Speech::Credentials.new( keyfile, scope: scope) end Google::Cloud::Speech::Project.new( Google::Cloud::Speech::Service.new( project, credentials, timeout: timeout, client_config: client_config)) end |