google-cloud-speech-v1 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +203 -0
- data/README.md +24 -0
- data/lib/google-cloud-speech-v1.rb +1 -0
- data/lib/google/cloud/common_resources_pb.rb +15 -0
- data/lib/google/cloud/speech/v1.rb +19 -0
- data/lib/google/cloud/speech/v1/cloud_speech_pb.rb +193 -0
- data/lib/google/cloud/speech/v1/cloud_speech_services_pb.rb +57 -0
- data/lib/google/cloud/speech/v1/speech.rb +21 -0
- data/lib/google/cloud/speech/v1/speech/client.rb +527 -0
- data/lib/google/cloud/speech/v1/speech/credentials.rb +51 -0
- data/lib/google/cloud/speech/v1/speech/operations.rb +558 -0
- data/lib/google/cloud/speech/v1/version.rb +28 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +59 -0
- data/proto_docs/google/api/resource.rb +247 -0
- data/proto_docs/google/cloud/speech/v1/cloud_speech.rb +753 -0
- data/proto_docs/google/longrunning/operations.rb +150 -0
- data/proto_docs/google/protobuf/any.rb +137 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +36 -0
- data/proto_docs/google/protobuf/timestamp.rb +116 -0
- data/proto_docs/google/rpc/status.rb +46 -0
- metadata +183 -0
@@ -0,0 +1,193 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/speech/v1/cloud_speech.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/annotations_pb'
|
7
|
+
require 'google/api/client_pb'
|
8
|
+
require 'google/api/field_behavior_pb'
|
9
|
+
require 'google/longrunning/operations_pb'
|
10
|
+
require 'google/protobuf/any_pb'
|
11
|
+
require 'google/protobuf/duration_pb'
|
12
|
+
require 'google/protobuf/timestamp_pb'
|
13
|
+
require 'google/rpc/status_pb'
|
14
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
15
|
+
add_file("google/cloud/speech/v1/cloud_speech.proto", :syntax => :proto3) do
|
16
|
+
add_message "google.cloud.speech.v1.RecognizeRequest" do
|
17
|
+
optional :config, :message, 1, "google.cloud.speech.v1.RecognitionConfig"
|
18
|
+
optional :audio, :message, 2, "google.cloud.speech.v1.RecognitionAudio"
|
19
|
+
end
|
20
|
+
add_message "google.cloud.speech.v1.LongRunningRecognizeRequest" do
|
21
|
+
optional :config, :message, 1, "google.cloud.speech.v1.RecognitionConfig"
|
22
|
+
optional :audio, :message, 2, "google.cloud.speech.v1.RecognitionAudio"
|
23
|
+
end
|
24
|
+
add_message "google.cloud.speech.v1.StreamingRecognizeRequest" do
|
25
|
+
oneof :streaming_request do
|
26
|
+
optional :streaming_config, :message, 1, "google.cloud.speech.v1.StreamingRecognitionConfig"
|
27
|
+
optional :audio_content, :bytes, 2
|
28
|
+
end
|
29
|
+
end
|
30
|
+
add_message "google.cloud.speech.v1.StreamingRecognitionConfig" do
|
31
|
+
optional :config, :message, 1, "google.cloud.speech.v1.RecognitionConfig"
|
32
|
+
optional :single_utterance, :bool, 2
|
33
|
+
optional :interim_results, :bool, 3
|
34
|
+
end
|
35
|
+
add_message "google.cloud.speech.v1.RecognitionConfig" do
|
36
|
+
optional :encoding, :enum, 1, "google.cloud.speech.v1.RecognitionConfig.AudioEncoding"
|
37
|
+
optional :sample_rate_hertz, :int32, 2
|
38
|
+
optional :audio_channel_count, :int32, 7
|
39
|
+
optional :enable_separate_recognition_per_channel, :bool, 12
|
40
|
+
optional :language_code, :string, 3
|
41
|
+
optional :max_alternatives, :int32, 4
|
42
|
+
optional :profanity_filter, :bool, 5
|
43
|
+
repeated :speech_contexts, :message, 6, "google.cloud.speech.v1.SpeechContext"
|
44
|
+
optional :enable_word_time_offsets, :bool, 8
|
45
|
+
optional :enable_automatic_punctuation, :bool, 11
|
46
|
+
optional :diarization_config, :message, 19, "google.cloud.speech.v1.SpeakerDiarizationConfig"
|
47
|
+
optional :metadata, :message, 9, "google.cloud.speech.v1.RecognitionMetadata"
|
48
|
+
optional :model, :string, 13
|
49
|
+
optional :use_enhanced, :bool, 14
|
50
|
+
end
|
51
|
+
add_enum "google.cloud.speech.v1.RecognitionConfig.AudioEncoding" do
|
52
|
+
value :ENCODING_UNSPECIFIED, 0
|
53
|
+
value :LINEAR16, 1
|
54
|
+
value :FLAC, 2
|
55
|
+
value :MULAW, 3
|
56
|
+
value :AMR, 4
|
57
|
+
value :AMR_WB, 5
|
58
|
+
value :OGG_OPUS, 6
|
59
|
+
value :SPEEX_WITH_HEADER_BYTE, 7
|
60
|
+
end
|
61
|
+
add_message "google.cloud.speech.v1.SpeakerDiarizationConfig" do
|
62
|
+
optional :enable_speaker_diarization, :bool, 1
|
63
|
+
optional :min_speaker_count, :int32, 2
|
64
|
+
optional :max_speaker_count, :int32, 3
|
65
|
+
optional :speaker_tag, :int32, 5
|
66
|
+
end
|
67
|
+
add_message "google.cloud.speech.v1.RecognitionMetadata" do
|
68
|
+
optional :interaction_type, :enum, 1, "google.cloud.speech.v1.RecognitionMetadata.InteractionType"
|
69
|
+
optional :industry_naics_code_of_audio, :uint32, 3
|
70
|
+
optional :microphone_distance, :enum, 4, "google.cloud.speech.v1.RecognitionMetadata.MicrophoneDistance"
|
71
|
+
optional :original_media_type, :enum, 5, "google.cloud.speech.v1.RecognitionMetadata.OriginalMediaType"
|
72
|
+
optional :recording_device_type, :enum, 6, "google.cloud.speech.v1.RecognitionMetadata.RecordingDeviceType"
|
73
|
+
optional :recording_device_name, :string, 7
|
74
|
+
optional :original_mime_type, :string, 8
|
75
|
+
optional :audio_topic, :string, 10
|
76
|
+
end
|
77
|
+
add_enum "google.cloud.speech.v1.RecognitionMetadata.InteractionType" do
|
78
|
+
value :INTERACTION_TYPE_UNSPECIFIED, 0
|
79
|
+
value :DISCUSSION, 1
|
80
|
+
value :PRESENTATION, 2
|
81
|
+
value :PHONE_CALL, 3
|
82
|
+
value :VOICEMAIL, 4
|
83
|
+
value :PROFESSIONALLY_PRODUCED, 5
|
84
|
+
value :VOICE_SEARCH, 6
|
85
|
+
value :VOICE_COMMAND, 7
|
86
|
+
value :DICTATION, 8
|
87
|
+
end
|
88
|
+
add_enum "google.cloud.speech.v1.RecognitionMetadata.MicrophoneDistance" do
|
89
|
+
value :MICROPHONE_DISTANCE_UNSPECIFIED, 0
|
90
|
+
value :NEARFIELD, 1
|
91
|
+
value :MIDFIELD, 2
|
92
|
+
value :FARFIELD, 3
|
93
|
+
end
|
94
|
+
add_enum "google.cloud.speech.v1.RecognitionMetadata.OriginalMediaType" do
|
95
|
+
value :ORIGINAL_MEDIA_TYPE_UNSPECIFIED, 0
|
96
|
+
value :AUDIO, 1
|
97
|
+
value :VIDEO, 2
|
98
|
+
end
|
99
|
+
add_enum "google.cloud.speech.v1.RecognitionMetadata.RecordingDeviceType" do
|
100
|
+
value :RECORDING_DEVICE_TYPE_UNSPECIFIED, 0
|
101
|
+
value :SMARTPHONE, 1
|
102
|
+
value :PC, 2
|
103
|
+
value :PHONE_LINE, 3
|
104
|
+
value :VEHICLE, 4
|
105
|
+
value :OTHER_OUTDOOR_DEVICE, 5
|
106
|
+
value :OTHER_INDOOR_DEVICE, 6
|
107
|
+
end
|
108
|
+
add_message "google.cloud.speech.v1.SpeechContext" do
|
109
|
+
repeated :phrases, :string, 1
|
110
|
+
end
|
111
|
+
add_message "google.cloud.speech.v1.RecognitionAudio" do
|
112
|
+
oneof :audio_source do
|
113
|
+
optional :content, :bytes, 1
|
114
|
+
optional :uri, :string, 2
|
115
|
+
end
|
116
|
+
end
|
117
|
+
add_message "google.cloud.speech.v1.RecognizeResponse" do
|
118
|
+
repeated :results, :message, 2, "google.cloud.speech.v1.SpeechRecognitionResult"
|
119
|
+
end
|
120
|
+
add_message "google.cloud.speech.v1.LongRunningRecognizeResponse" do
|
121
|
+
repeated :results, :message, 2, "google.cloud.speech.v1.SpeechRecognitionResult"
|
122
|
+
end
|
123
|
+
add_message "google.cloud.speech.v1.LongRunningRecognizeMetadata" do
|
124
|
+
optional :progress_percent, :int32, 1
|
125
|
+
optional :start_time, :message, 2, "google.protobuf.Timestamp"
|
126
|
+
optional :last_update_time, :message, 3, "google.protobuf.Timestamp"
|
127
|
+
end
|
128
|
+
add_message "google.cloud.speech.v1.StreamingRecognizeResponse" do
|
129
|
+
optional :error, :message, 1, "google.rpc.Status"
|
130
|
+
repeated :results, :message, 2, "google.cloud.speech.v1.StreamingRecognitionResult"
|
131
|
+
optional :speech_event_type, :enum, 4, "google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType"
|
132
|
+
end
|
133
|
+
add_enum "google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType" do
|
134
|
+
value :SPEECH_EVENT_UNSPECIFIED, 0
|
135
|
+
value :END_OF_SINGLE_UTTERANCE, 1
|
136
|
+
end
|
137
|
+
add_message "google.cloud.speech.v1.StreamingRecognitionResult" do
|
138
|
+
repeated :alternatives, :message, 1, "google.cloud.speech.v1.SpeechRecognitionAlternative"
|
139
|
+
optional :is_final, :bool, 2
|
140
|
+
optional :stability, :float, 3
|
141
|
+
optional :result_end_time, :message, 4, "google.protobuf.Duration"
|
142
|
+
optional :channel_tag, :int32, 5
|
143
|
+
optional :language_code, :string, 6
|
144
|
+
end
|
145
|
+
add_message "google.cloud.speech.v1.SpeechRecognitionResult" do
|
146
|
+
repeated :alternatives, :message, 1, "google.cloud.speech.v1.SpeechRecognitionAlternative"
|
147
|
+
optional :channel_tag, :int32, 2
|
148
|
+
end
|
149
|
+
add_message "google.cloud.speech.v1.SpeechRecognitionAlternative" do
|
150
|
+
optional :transcript, :string, 1
|
151
|
+
optional :confidence, :float, 2
|
152
|
+
repeated :words, :message, 3, "google.cloud.speech.v1.WordInfo"
|
153
|
+
end
|
154
|
+
add_message "google.cloud.speech.v1.WordInfo" do
|
155
|
+
optional :start_time, :message, 1, "google.protobuf.Duration"
|
156
|
+
optional :end_time, :message, 2, "google.protobuf.Duration"
|
157
|
+
optional :word, :string, 3
|
158
|
+
optional :speaker_tag, :int32, 5
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
module Google
|
164
|
+
module Cloud
|
165
|
+
module Speech
|
166
|
+
module V1
|
167
|
+
RecognizeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.RecognizeRequest").msgclass
|
168
|
+
LongRunningRecognizeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.LongRunningRecognizeRequest").msgclass
|
169
|
+
StreamingRecognizeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.StreamingRecognizeRequest").msgclass
|
170
|
+
StreamingRecognitionConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.StreamingRecognitionConfig").msgclass
|
171
|
+
RecognitionConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.RecognitionConfig").msgclass
|
172
|
+
RecognitionConfig::AudioEncoding = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.RecognitionConfig.AudioEncoding").enummodule
|
173
|
+
SpeakerDiarizationConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.SpeakerDiarizationConfig").msgclass
|
174
|
+
RecognitionMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.RecognitionMetadata").msgclass
|
175
|
+
RecognitionMetadata::InteractionType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.RecognitionMetadata.InteractionType").enummodule
|
176
|
+
RecognitionMetadata::MicrophoneDistance = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.RecognitionMetadata.MicrophoneDistance").enummodule
|
177
|
+
RecognitionMetadata::OriginalMediaType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.RecognitionMetadata.OriginalMediaType").enummodule
|
178
|
+
RecognitionMetadata::RecordingDeviceType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.RecognitionMetadata.RecordingDeviceType").enummodule
|
179
|
+
SpeechContext = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.SpeechContext").msgclass
|
180
|
+
RecognitionAudio = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.RecognitionAudio").msgclass
|
181
|
+
RecognizeResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.RecognizeResponse").msgclass
|
182
|
+
LongRunningRecognizeResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.LongRunningRecognizeResponse").msgclass
|
183
|
+
LongRunningRecognizeMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.LongRunningRecognizeMetadata").msgclass
|
184
|
+
StreamingRecognizeResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.StreamingRecognizeResponse").msgclass
|
185
|
+
StreamingRecognizeResponse::SpeechEventType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType").enummodule
|
186
|
+
StreamingRecognitionResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.StreamingRecognitionResult").msgclass
|
187
|
+
SpeechRecognitionResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.SpeechRecognitionResult").msgclass
|
188
|
+
SpeechRecognitionAlternative = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.SpeechRecognitionAlternative").msgclass
|
189
|
+
WordInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.WordInfo").msgclass
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: google/cloud/speech/v1/cloud_speech.proto for package 'google.cloud.speech.v1'
|
3
|
+
# Original file comments:
|
4
|
+
# Copyright 2019 Google LLC.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
#
|
19
|
+
|
20
|
+
require 'grpc'
|
21
|
+
require 'google/cloud/speech/v1/cloud_speech_pb'
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module Speech
|
26
|
+
module V1
|
27
|
+
module Speech
|
28
|
+
# Service that implements Google Cloud Speech API.
|
29
|
+
class Service
|
30
|
+
|
31
|
+
include GRPC::GenericService
|
32
|
+
|
33
|
+
self.marshal_class_method = :encode
|
34
|
+
self.unmarshal_class_method = :decode
|
35
|
+
self.service_name = 'google.cloud.speech.v1.Speech'
|
36
|
+
|
37
|
+
# Performs synchronous speech recognition: receive results after all audio
|
38
|
+
# has been sent and processed.
|
39
|
+
rpc :Recognize, RecognizeRequest, RecognizeResponse
|
40
|
+
# Performs asynchronous speech recognition: receive results via the
|
41
|
+
# google.longrunning.Operations interface. Returns either an
|
42
|
+
# `Operation.error` or an `Operation.response` which contains
|
43
|
+
# a `LongRunningRecognizeResponse` message.
|
44
|
+
# For more information on asynchronous speech recognition, see the
|
45
|
+
# [how-to](https://cloud.google.com/speech-to-text/docs/async-recognize).
|
46
|
+
rpc :LongRunningRecognize, LongRunningRecognizeRequest, Google::Longrunning::Operation
|
47
|
+
# Performs bidirectional streaming speech recognition: receive results while
|
48
|
+
# sending audio. This method is only available via the gRPC API (not REST).
|
49
|
+
rpc :StreamingRecognize, stream(StreamingRecognizeRequest), stream(StreamingRecognizeResponse)
|
50
|
+
end
|
51
|
+
|
52
|
+
Stub = Service.rpc_stub_class
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/speech/v1/speech/client"
|
20
|
+
require "google/cloud/speech/v1/speech/operations"
|
21
|
+
require "google/cloud/speech/v1/speech/credentials"
|
@@ -0,0 +1,527 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "gapic/common"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/errors"
|
24
|
+
require "google/cloud/speech/v1/version"
|
25
|
+
require "google/cloud/speech/v1/cloud_speech_pb"
|
26
|
+
require "google/cloud/speech/v1/speech/credentials"
|
27
|
+
require "google/cloud/speech/v1/speech/operations"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Cloud
|
31
|
+
module Speech
|
32
|
+
module V1
|
33
|
+
module Speech
|
34
|
+
##
|
35
|
+
# Client for the Speech service.
|
36
|
+
#
|
37
|
+
# Service that implements Google Cloud Speech API.
|
38
|
+
#
|
39
|
+
class Client
|
40
|
+
# @private
|
41
|
+
attr_reader :speech_stub
|
42
|
+
|
43
|
+
##
|
44
|
+
# Configure the Speech Client class.
|
45
|
+
#
|
46
|
+
# See {Google::Cloud::Speech::V1::Speech::Client::Configuration}
|
47
|
+
# for a description of the configuration fields.
|
48
|
+
#
|
49
|
+
# ## Example
|
50
|
+
#
|
51
|
+
# To modify the configuration for all Speech clients:
|
52
|
+
#
|
53
|
+
# Google::Cloud::Speech::V1::Speech::Client.configure do |config|
|
54
|
+
# config.timeout = 10_000
|
55
|
+
# end
|
56
|
+
#
|
57
|
+
# @yield [config] Configure the Client client.
|
58
|
+
# @yieldparam config [Client::Configuration]
|
59
|
+
#
|
60
|
+
# @return [Client::Configuration]
|
61
|
+
#
|
62
|
+
def self.configure
|
63
|
+
@configure ||= begin
|
64
|
+
namespace = ["Google", "Cloud", "Speech", "V1"]
|
65
|
+
parent_config = while namespace.any?
|
66
|
+
parent_name = namespace.join "::"
|
67
|
+
parent_const = const_get parent_name
|
68
|
+
break parent_const.configure if parent_const&.respond_to? :configure
|
69
|
+
namespace.pop
|
70
|
+
end
|
71
|
+
default_config = Client::Configuration.new parent_config
|
72
|
+
|
73
|
+
default_config.rpcs.recognize.timeout = 5000.0
|
74
|
+
default_config.rpcs.recognize.retry_policy = {
|
75
|
+
initial_delay: 0.1,
|
76
|
+
max_delay: 60.0,
|
77
|
+
multiplier: 1.3,
|
78
|
+
retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
|
79
|
+
}
|
80
|
+
|
81
|
+
default_config.rpcs.long_running_recognize.timeout = 5000.0
|
82
|
+
|
83
|
+
default_config.rpcs.streaming_recognize.timeout = 5000.0
|
84
|
+
default_config.rpcs.streaming_recognize.retry_policy = {
|
85
|
+
initial_delay: 0.1,
|
86
|
+
max_delay: 60.0,
|
87
|
+
multiplier: 1.3,
|
88
|
+
retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
|
89
|
+
}
|
90
|
+
|
91
|
+
default_config
|
92
|
+
end
|
93
|
+
yield @configure if block_given?
|
94
|
+
@configure
|
95
|
+
end
|
96
|
+
|
97
|
+
##
|
98
|
+
# Configure the Speech Client instance.
|
99
|
+
#
|
100
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
101
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
102
|
+
# should be made on {Client.configure}.
|
103
|
+
#
|
104
|
+
# See {Google::Cloud::Speech::V1::Speech::Client::Configuration}
|
105
|
+
# for a description of the configuration fields.
|
106
|
+
#
|
107
|
+
# @yield [config] Configure the Client client.
|
108
|
+
# @yieldparam config [Client::Configuration]
|
109
|
+
#
|
110
|
+
# @return [Client::Configuration]
|
111
|
+
#
|
112
|
+
def configure
|
113
|
+
yield @config if block_given?
|
114
|
+
@config
|
115
|
+
end
|
116
|
+
|
117
|
+
##
|
118
|
+
# Create a new Speech client object.
|
119
|
+
#
|
120
|
+
# ## Examples
|
121
|
+
#
|
122
|
+
# To create a new Speech client with the default
|
123
|
+
# configuration:
|
124
|
+
#
|
125
|
+
# client = Google::Cloud::Speech::V1::Speech::Client.new
|
126
|
+
#
|
127
|
+
# To create a new Speech client with a custom
|
128
|
+
# configuration:
|
129
|
+
#
|
130
|
+
# client = Google::Cloud::Speech::V1::Speech::Client.new do |config|
|
131
|
+
# config.timeout = 10_000
|
132
|
+
# end
|
133
|
+
#
|
134
|
+
# @yield [config] Configure the Speech client.
|
135
|
+
# @yieldparam config [Client::Configuration]
|
136
|
+
#
|
137
|
+
def initialize
|
138
|
+
# These require statements are intentionally placed here to initialize
|
139
|
+
# the gRPC module only when it's required.
|
140
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
141
|
+
require "gapic/grpc"
|
142
|
+
require "google/cloud/speech/v1/cloud_speech_services_pb"
|
143
|
+
|
144
|
+
# Create the configuration object
|
145
|
+
@config = Configuration.new Client.configure
|
146
|
+
|
147
|
+
# Yield the configuration if needed
|
148
|
+
yield @config if block_given?
|
149
|
+
|
150
|
+
# Create credentials
|
151
|
+
credentials = @config.credentials
|
152
|
+
credentials ||= Credentials.default scope: @config.scope
|
153
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
154
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
155
|
+
end
|
156
|
+
@quota_project_id = credentials.respond_to?(:quota_project_id) ? credentials.quota_project_id : nil
|
157
|
+
|
158
|
+
@operations_client = Operations.new do |config|
|
159
|
+
config.credentials = credentials
|
160
|
+
end
|
161
|
+
|
162
|
+
@speech_stub = Gapic::ServiceStub.new(
|
163
|
+
Google::Cloud::Speech::V1::Speech::Stub,
|
164
|
+
credentials: credentials,
|
165
|
+
endpoint: @config.endpoint,
|
166
|
+
channel_args: @config.channel_args,
|
167
|
+
interceptors: @config.interceptors
|
168
|
+
)
|
169
|
+
end
|
170
|
+
|
171
|
+
# Service calls
|
172
|
+
|
173
|
+
##
|
174
|
+
# Performs synchronous speech recognition: receive results after all audio
|
175
|
+
# has been sent and processed.
|
176
|
+
#
|
177
|
+
# @overload recognize(request, options = nil)
|
178
|
+
# @param request [Google::Cloud::Speech::V1::RecognizeRequest | Hash]
|
179
|
+
# Performs synchronous speech recognition: receive results after all audio
|
180
|
+
# has been sent and processed.
|
181
|
+
# @param options [Gapic::CallOptions, Hash]
|
182
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
183
|
+
#
|
184
|
+
# @overload recognize(config: nil, audio: nil)
|
185
|
+
# @param config [Google::Cloud::Speech::V1::RecognitionConfig | Hash]
|
186
|
+
# Required. Provides information to the recognizer that specifies how to
|
187
|
+
# process the request.
|
188
|
+
# @param audio [Google::Cloud::Speech::V1::RecognitionAudio | Hash]
|
189
|
+
# Required. The audio data to be recognized.
|
190
|
+
#
|
191
|
+
#
|
192
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
193
|
+
# @yieldparam response [Google::Cloud::Speech::V1::RecognizeResponse]
|
194
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
195
|
+
#
|
196
|
+
# @return [Google::Cloud::Speech::V1::RecognizeResponse]
|
197
|
+
#
|
198
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
199
|
+
#
|
200
|
+
def recognize request, options = nil
|
201
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
202
|
+
|
203
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Speech::V1::RecognizeRequest
|
204
|
+
|
205
|
+
# Converts hash and nil to an options object
|
206
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
207
|
+
|
208
|
+
# Customize the options with defaults
|
209
|
+
metadata = @config.rpcs.recognize.metadata.to_h
|
210
|
+
|
211
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
212
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
213
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
214
|
+
gapic_version: ::Google::Cloud::Speech::V1::VERSION
|
215
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
216
|
+
|
217
|
+
options.apply_defaults timeout: @config.rpcs.recognize.timeout,
|
218
|
+
metadata: metadata,
|
219
|
+
retry_policy: @config.rpcs.recognize.retry_policy
|
220
|
+
options.apply_defaults metadata: @config.metadata,
|
221
|
+
retry_policy: @config.retry_policy
|
222
|
+
|
223
|
+
@speech_stub.call_rpc :recognize, request, options: options do |response, operation|
|
224
|
+
yield response, operation if block_given?
|
225
|
+
return response
|
226
|
+
end
|
227
|
+
rescue GRPC::BadStatus => e
|
228
|
+
raise Google::Cloud::Error.from_error(e)
|
229
|
+
end
|
230
|
+
|
231
|
+
##
|
232
|
+
# Performs asynchronous speech recognition: receive results via the
|
233
|
+
# google.longrunning.Operations interface. Returns either an
|
234
|
+
# `Operation.error` or an `Operation.response` which contains
|
235
|
+
# a `LongRunningRecognizeResponse` message.
|
236
|
+
# For more information on asynchronous speech recognition, see the
|
237
|
+
# [how-to](https://cloud.google.com/speech-to-text/docs/async-recognize).
|
238
|
+
#
|
239
|
+
# @overload long_running_recognize(request, options = nil)
|
240
|
+
# @param request [Google::Cloud::Speech::V1::LongRunningRecognizeRequest | Hash]
|
241
|
+
# Performs asynchronous speech recognition: receive results via the
|
242
|
+
# google.longrunning.Operations interface. Returns either an
|
243
|
+
# `Operation.error` or an `Operation.response` which contains
|
244
|
+
# a `LongRunningRecognizeResponse` message.
|
245
|
+
# For more information on asynchronous speech recognition, see the
|
246
|
+
# [how-to](https://cloud.google.com/speech-to-text/docs/async-recognize).
|
247
|
+
# @param options [Gapic::CallOptions, Hash]
|
248
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
249
|
+
#
|
250
|
+
# @overload long_running_recognize(config: nil, audio: nil)
|
251
|
+
# @param config [Google::Cloud::Speech::V1::RecognitionConfig | Hash]
|
252
|
+
# Required. Provides information to the recognizer that specifies how to
|
253
|
+
# process the request.
|
254
|
+
# @param audio [Google::Cloud::Speech::V1::RecognitionAudio | Hash]
|
255
|
+
# Required. The audio data to be recognized.
|
256
|
+
#
|
257
|
+
#
|
258
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
259
|
+
# @yieldparam response [Gapic::Operation]
|
260
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
261
|
+
#
|
262
|
+
# @return [Gapic::Operation]
|
263
|
+
#
|
264
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
265
|
+
#
|
266
|
+
def long_running_recognize request, options = nil
|
267
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
268
|
+
|
269
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Speech::V1::LongRunningRecognizeRequest
|
270
|
+
|
271
|
+
# Converts hash and nil to an options object
|
272
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
273
|
+
|
274
|
+
# Customize the options with defaults
|
275
|
+
metadata = @config.rpcs.long_running_recognize.metadata.to_h
|
276
|
+
|
277
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
278
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
279
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
280
|
+
gapic_version: ::Google::Cloud::Speech::V1::VERSION
|
281
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
282
|
+
|
283
|
+
options.apply_defaults timeout: @config.rpcs.long_running_recognize.timeout,
|
284
|
+
metadata: metadata,
|
285
|
+
retry_policy: @config.rpcs.long_running_recognize.retry_policy
|
286
|
+
options.apply_defaults metadata: @config.metadata,
|
287
|
+
retry_policy: @config.retry_policy
|
288
|
+
|
289
|
+
@speech_stub.call_rpc :long_running_recognize, request, options: options do |response, operation|
|
290
|
+
response = Gapic::Operation.new response, @operations_client, options: options
|
291
|
+
yield response, operation if block_given?
|
292
|
+
return response
|
293
|
+
end
|
294
|
+
rescue GRPC::BadStatus => e
|
295
|
+
raise Google::Cloud::Error.from_error(e)
|
296
|
+
end
|
297
|
+
|
298
|
+
##
|
299
|
+
# Performs bidirectional streaming speech recognition: receive results while
|
300
|
+
# sending audio. This method is only available via the gRPC API (not REST).
|
301
|
+
#
|
302
|
+
# @param request [Gapic::StreamInput, Enumerable<Google::Cloud::Speech::V1::StreamingRecognizeRequest | Hash>]
|
303
|
+
# An enumerable of {Google::Cloud::Speech::V1::StreamingRecognizeRequest} instances.
|
304
|
+
# @param options [Gapic::CallOptions, Hash]
|
305
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
306
|
+
#
|
307
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
308
|
+
# @yieldparam response [Enumerable<Google::Cloud::Speech::V1::StreamingRecognizeResponse>]
|
309
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
310
|
+
#
|
311
|
+
# @return [Enumerable<Google::Cloud::Speech::V1::StreamingRecognizeResponse>]
|
312
|
+
#
|
313
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
314
|
+
#
|
315
|
+
def streaming_recognize request, options = nil
|
316
|
+
unless request.is_a? Enumerable
|
317
|
+
raise ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
|
318
|
+
request = request.to_enum
|
319
|
+
end
|
320
|
+
|
321
|
+
request = request.lazy.map do |req|
|
322
|
+
Gapic::Protobuf.coerce req, to: Google::Cloud::Speech::V1::StreamingRecognizeRequest
|
323
|
+
end
|
324
|
+
|
325
|
+
# Converts hash and nil to an options object
|
326
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
327
|
+
|
328
|
+
# Customize the options with defaults
|
329
|
+
metadata = @config.rpcs.streaming_recognize.metadata.to_h
|
330
|
+
|
331
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
332
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
333
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
334
|
+
gapic_version: ::Google::Cloud::Speech::V1::VERSION
|
335
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
336
|
+
|
337
|
+
options.apply_defaults timeout: @config.rpcs.streaming_recognize.timeout,
|
338
|
+
metadata: metadata,
|
339
|
+
retry_policy: @config.rpcs.streaming_recognize.retry_policy
|
340
|
+
options.apply_defaults metadata: @config.metadata,
|
341
|
+
retry_policy: @config.retry_policy
|
342
|
+
|
343
|
+
@speech_stub.call_rpc :streaming_recognize, request, options: options do |response, operation|
|
344
|
+
yield response, operation if block_given?
|
345
|
+
return response
|
346
|
+
end
|
347
|
+
rescue GRPC::BadStatus => e
|
348
|
+
raise Google::Cloud::Error.from_error(e)
|
349
|
+
end
|
350
|
+
|
351
|
+
##
|
352
|
+
# Configuration class for the Speech API.
|
353
|
+
#
|
354
|
+
# This class represents the configuration for Speech,
|
355
|
+
# providing control over timeouts, retry behavior, logging, transport
|
356
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
357
|
+
# applied individually to specific RPCs. See
|
358
|
+
# {Google::Cloud::Speech::V1::Speech::Client::Configuration::Rpcs}
|
359
|
+
# for a list of RPCs that can be configured independently.
|
360
|
+
#
|
361
|
+
# Configuration can be applied globally to all clients, or to a single client
|
362
|
+
# on construction.
|
363
|
+
#
|
364
|
+
# # Examples
|
365
|
+
#
|
366
|
+
# To modify the global config, setting the timeout for recognize
|
367
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
368
|
+
#
|
369
|
+
# Google::Cloud::Speech::V1::Speech::Client.configure do |config|
|
370
|
+
# config.timeout = 10_000
|
371
|
+
# config.rpcs.recognize.timeout = 20_000
|
372
|
+
# end
|
373
|
+
#
|
374
|
+
# To apply the above configuration only to a new client:
|
375
|
+
#
|
376
|
+
# client = Google::Cloud::Speech::V1::Speech::Client.new do |config|
|
377
|
+
# config.timeout = 10_000
|
378
|
+
# config.rpcs.recognize.timeout = 20_000
|
379
|
+
# end
|
380
|
+
#
|
381
|
+
# @!attribute [rw] endpoint
|
382
|
+
# The hostname or hostname:port of the service endpoint.
|
383
|
+
# Defaults to `"speech.googleapis.com"`.
|
384
|
+
# @return [String]
|
385
|
+
# @!attribute [rw] credentials
|
386
|
+
# Credentials to send with calls. You may provide any of the following types:
|
387
|
+
# * (`String`) The path to a service account key file in JSON format
|
388
|
+
# * (`Hash`) A service account key as a Hash
|
389
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
390
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
391
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
392
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
393
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
394
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
395
|
+
# * (`nil`) indicating no credentials
|
396
|
+
# @return [Object]
|
397
|
+
# @!attribute [rw] scope
|
398
|
+
# The OAuth scopes
|
399
|
+
# @return [Array<String>]
|
400
|
+
# @!attribute [rw] lib_name
|
401
|
+
# The library name as recorded in instrumentation and logging
|
402
|
+
# @return [String]
|
403
|
+
# @!attribute [rw] lib_version
|
404
|
+
# The library version as recorded in instrumentation and logging
|
405
|
+
# @return [String]
|
406
|
+
# @!attribute [rw] channel_args
|
407
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
408
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
409
|
+
# @return [Hash]
|
410
|
+
# @!attribute [rw] interceptors
|
411
|
+
# An array of interceptors that are run before calls are executed.
|
412
|
+
# @return [Array<GRPC::ClientInterceptor>]
|
413
|
+
# @!attribute [rw] timeout
|
414
|
+
# The call timeout in milliseconds.
|
415
|
+
# @return [Numeric]
|
416
|
+
# @!attribute [rw] metadata
|
417
|
+
# Additional gRPC headers to be sent with the call.
|
418
|
+
# @return [Hash{Symbol=>String}]
|
419
|
+
# @!attribute [rw] retry_policy
|
420
|
+
# The retry policy. The value is a hash with the following keys:
|
421
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
422
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
423
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
424
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
425
|
+
# trigger a retry.
|
426
|
+
# @return [Hash]
|
427
|
+
#
|
428
|
+
class Configuration
|
429
|
+
extend Gapic::Config
|
430
|
+
|
431
|
+
config_attr :endpoint, "speech.googleapis.com", String
|
432
|
+
config_attr :credentials, nil do |value|
|
433
|
+
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
434
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
435
|
+
allowed.any? { |klass| klass === value }
|
436
|
+
end
|
437
|
+
config_attr :scope, nil, String, Array, nil
|
438
|
+
config_attr :lib_name, nil, String, nil
|
439
|
+
config_attr :lib_version, nil, String, nil
|
440
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, Hash, nil)
|
441
|
+
config_attr :interceptors, nil, Array, nil
|
442
|
+
config_attr :timeout, nil, Numeric, nil
|
443
|
+
config_attr :metadata, nil, Hash, nil
|
444
|
+
config_attr :retry_policy, nil, Hash, Proc, nil
|
445
|
+
|
446
|
+
# @private
|
447
|
+
def initialize parent_config = nil
|
448
|
+
@parent_config = parent_config unless parent_config.nil?
|
449
|
+
|
450
|
+
yield self if block_given?
|
451
|
+
end
|
452
|
+
|
453
|
+
##
|
454
|
+
# Configurations for individual RPCs
|
455
|
+
# @return [Rpcs]
|
456
|
+
#
|
457
|
+
def rpcs
|
458
|
+
@rpcs ||= begin
|
459
|
+
parent_rpcs = nil
|
460
|
+
parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
|
461
|
+
Rpcs.new parent_rpcs
|
462
|
+
end
|
463
|
+
end
|
464
|
+
|
465
|
+
##
|
466
|
+
# Configuration RPC class for the Speech API.
|
467
|
+
#
|
468
|
+
# Includes fields providing the configuration for each RPC in this service.
|
469
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
470
|
+
# the following configuration fields:
|
471
|
+
#
|
472
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
|
473
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
474
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
475
|
+
# include the following keys:
|
476
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
477
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
478
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
479
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
480
|
+
# trigger a retry.
|
481
|
+
#
|
482
|
+
class Rpcs
|
483
|
+
##
|
484
|
+
# RPC-specific configuration for `recognize`
|
485
|
+
# @return [Gapic::Config::Method]
|
486
|
+
#
|
487
|
+
attr_reader :recognize
|
488
|
+
##
|
489
|
+
# RPC-specific configuration for `long_running_recognize`
|
490
|
+
# @return [Gapic::Config::Method]
|
491
|
+
#
|
492
|
+
attr_reader :long_running_recognize
|
493
|
+
##
|
494
|
+
# RPC-specific configuration for `streaming_recognize`
|
495
|
+
# @return [Gapic::Config::Method]
|
496
|
+
#
|
497
|
+
attr_reader :streaming_recognize
|
498
|
+
|
499
|
+
# @private
|
500
|
+
def initialize parent_rpcs = nil
|
501
|
+
recognize_config = parent_rpcs&.recognize if parent_rpcs&.respond_to? :recognize
|
502
|
+
@recognize = Gapic::Config::Method.new recognize_config
|
503
|
+
long_running_recognize_config = parent_rpcs&.long_running_recognize if parent_rpcs&.respond_to? :long_running_recognize
|
504
|
+
@long_running_recognize = Gapic::Config::Method.new long_running_recognize_config
|
505
|
+
streaming_recognize_config = parent_rpcs&.streaming_recognize if parent_rpcs&.respond_to? :streaming_recognize
|
506
|
+
@streaming_recognize = Gapic::Config::Method.new streaming_recognize_config
|
507
|
+
|
508
|
+
yield self if block_given?
|
509
|
+
end
|
510
|
+
end
|
511
|
+
end
|
512
|
+
end
|
513
|
+
end
|
514
|
+
end
|
515
|
+
end
|
516
|
+
end
|
517
|
+
end
|
518
|
+
|
519
|
+
# rubocop:disable Lint/HandleExceptions
|
520
|
+
|
521
|
+
# Once client is loaded, load helpers.rb if it exists.
|
522
|
+
begin
|
523
|
+
require "google/cloud/speech/v1/speech/helpers"
|
524
|
+
rescue LoadError
|
525
|
+
end
|
526
|
+
|
527
|
+
# rubocop:enable Lint/HandleExceptions
|