google-cloud-speech-v1p1beta1 0.9.1 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +8 -8
- data/README.md +1 -1
- data/lib/google/cloud/speech/v1p1beta1/adaptation/client.rb +62 -49
- data/lib/google/cloud/speech/v1p1beta1/cloud_speech_adaptation_services_pb.rb +1 -1
- data/lib/google/cloud/speech/v1p1beta1/cloud_speech_pb.rb +4 -0
- data/lib/google/cloud/speech/v1p1beta1/cloud_speech_services_pb.rb +1 -1
- data/lib/google/cloud/speech/v1p1beta1/resource_pb.rb +11 -0
- data/lib/google/cloud/speech/v1p1beta1/speech/client.rb +41 -48
- data/lib/google/cloud/speech/v1p1beta1/speech/operations.rb +34 -25
- data/lib/google/cloud/speech/v1p1beta1/version.rb +1 -1
- data/proto_docs/google/api/field_behavior.rb +7 -1
- data/proto_docs/google/cloud/speech/v1p1beta1/cloud_speech.rb +16 -0
- data/proto_docs/google/cloud/speech/v1p1beta1/cloud_speech_adaptation.rb +2 -2
- data/proto_docs/google/cloud/speech/v1p1beta1/resource.rb +30 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d2d936a6d4c70c9577e5c3071cded47b5310578326e2b099c29a817e47f963f
|
4
|
+
data.tar.gz: c3164937074233e529d5ec464ef7c98a5bfd2f3243f3f29fd836d74c20dee3d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56a8778e17b5951a7ef6c91902ba2a9a190790e8cb45d46741ca712a4eacc5ea8954522dcbecf0772eeb7878fae5b10b7c34333ad5ec7ce6d7e984d852b3d930
|
7
|
+
data.tar.gz: 6037bf2e2e1d281df5a6274ca5febbd755b8d4fd8b7d4ec1f62c6664865a1494e48d552b413c8b2541d2518151685170e446ea89f10028bb91359fe9243cbc03
|
data/AUTHENTICATION.md
CHANGED
@@ -66,11 +66,11 @@ The environment variables that google-cloud-speech-v1p1beta1
|
|
66
66
|
checks for credentials are configured on the service Credentials class (such as
|
67
67
|
{::Google::Cloud::Speech::V1p1beta1::Speech::Credentials}):
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
69
|
+
* `SPEECH_CREDENTIALS` - Path to JSON file, or JSON contents
|
70
|
+
* `SPEECH_KEYFILE` - Path to JSON file, or JSON contents
|
71
|
+
* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
|
72
|
+
* `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents
|
73
|
+
* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
|
74
74
|
|
75
75
|
```ruby
|
76
76
|
require "google/cloud/speech/v1p1beta1"
|
@@ -82,8 +82,8 @@ client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
|
82
82
|
|
83
83
|
### Configuration
|
84
84
|
|
85
|
-
The **Credentials JSON** can be configured instead of
|
86
|
-
environment
|
85
|
+
The path to the **Credentials JSON** file can be configured instead of storing
|
86
|
+
it in an environment variable. Either on an individual client initialization:
|
87
87
|
|
88
88
|
```ruby
|
89
89
|
require "google/cloud/speech/v1p1beta1"
|
@@ -93,7 +93,7 @@ client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new do |config|
|
|
93
93
|
end
|
94
94
|
```
|
95
95
|
|
96
|
-
Or
|
96
|
+
Or globally for all clients:
|
97
97
|
|
98
98
|
```ruby
|
99
99
|
require "google/cloud/speech/v1p1beta1"
|
data/README.md
CHANGED
@@ -33,7 +33,7 @@ In order to use this library, you first need to go through the following steps:
|
|
33
33
|
require "google/cloud/speech/v1p1beta1"
|
34
34
|
|
35
35
|
client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
36
|
-
request =
|
36
|
+
request = ::Google::Cloud::Speech::V1p1beta1::RecognizeRequest.new # (request fields as keyword arguments...)
|
37
37
|
response = client.recognize request
|
38
38
|
```
|
39
39
|
|
@@ -41,13 +41,12 @@ module Google
|
|
41
41
|
# See {::Google::Cloud::Speech::V1p1beta1::Adaptation::Client::Configuration}
|
42
42
|
# for a description of the configuration fields.
|
43
43
|
#
|
44
|
-
#
|
44
|
+
# @example
|
45
45
|
#
|
46
|
-
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
# end
|
46
|
+
# # Modify the configuration for all Adaptation clients
|
47
|
+
# ::Google::Cloud::Speech::V1p1beta1::Adaptation::Client.configure do |config|
|
48
|
+
# config.timeout = 10.0
|
49
|
+
# end
|
51
50
|
#
|
52
51
|
# @yield [config] Configure the Client client.
|
53
52
|
# @yieldparam config [Client::Configuration]
|
@@ -94,19 +93,15 @@ module Google
|
|
94
93
|
##
|
95
94
|
# Create a new Adaptation client object.
|
96
95
|
#
|
97
|
-
#
|
98
|
-
#
|
99
|
-
# To create a new Adaptation client with the default
|
100
|
-
# configuration:
|
101
|
-
#
|
102
|
-
# client = ::Google::Cloud::Speech::V1p1beta1::Adaptation::Client.new
|
96
|
+
# @example
|
103
97
|
#
|
104
|
-
#
|
105
|
-
#
|
98
|
+
# # Create a client using the default configuration
|
99
|
+
# client = ::Google::Cloud::Speech::V1p1beta1::Adaptation::Client.new
|
106
100
|
#
|
107
|
-
#
|
108
|
-
#
|
109
|
-
#
|
101
|
+
# # Create a client using a custom configuration
|
102
|
+
# client = ::Google::Cloud::Speech::V1p1beta1::Adaptation::Client.new do |config|
|
103
|
+
# config.timeout = 10.0
|
104
|
+
# end
|
110
105
|
#
|
111
106
|
# @yield [config] Configure the Adaptation client.
|
112
107
|
# @yieldparam config [Client::Configuration]
|
@@ -126,14 +121,13 @@ module Google
|
|
126
121
|
|
127
122
|
# Create credentials
|
128
123
|
credentials = @config.credentials
|
129
|
-
# Use self-signed JWT if the
|
124
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
130
125
|
# but only if the default endpoint does not have a region prefix.
|
131
|
-
enable_self_signed_jwt = @config.
|
132
|
-
@config.endpoint == Client.configure.endpoint &&
|
126
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
133
127
|
!@config.endpoint.split(".").first.include?("-")
|
134
128
|
credentials ||= Credentials.default scope: @config.scope,
|
135
129
|
enable_self_signed_jwt: enable_self_signed_jwt
|
136
|
-
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
130
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
137
131
|
credentials = Credentials.new credentials, scope: @config.scope
|
138
132
|
end
|
139
133
|
@quota_project_id = @config.quota_project
|
@@ -175,7 +169,7 @@ module Google
|
|
175
169
|
# Format:
|
176
170
|
# \\{api_version}/projects/\\{project}/locations/\\{location}/phraseSets
|
177
171
|
# @param phrase_set_id [::String]
|
178
|
-
# The ID to use for the phrase set, which will become the final
|
172
|
+
# Required. The ID to use for the phrase set, which will become the final
|
179
173
|
# component of the phrase set's resource name.
|
180
174
|
#
|
181
175
|
# This value should be 4-63 characters, and valid characters
|
@@ -217,7 +211,9 @@ module Google
|
|
217
211
|
options.apply_defaults timeout: @config.rpcs.create_phrase_set.timeout,
|
218
212
|
metadata: metadata,
|
219
213
|
retry_policy: @config.rpcs.create_phrase_set.retry_policy
|
220
|
-
|
214
|
+
|
215
|
+
options.apply_defaults timeout: @config.timeout,
|
216
|
+
metadata: @config.metadata,
|
221
217
|
retry_policy: @config.retry_policy
|
222
218
|
|
223
219
|
@adaptation_stub.call_rpc :create_phrase_set, request, options: options do |response, operation|
|
@@ -285,7 +281,9 @@ module Google
|
|
285
281
|
options.apply_defaults timeout: @config.rpcs.get_phrase_set.timeout,
|
286
282
|
metadata: metadata,
|
287
283
|
retry_policy: @config.rpcs.get_phrase_set.retry_policy
|
288
|
-
|
284
|
+
|
285
|
+
options.apply_defaults timeout: @config.timeout,
|
286
|
+
metadata: @config.metadata,
|
289
287
|
retry_policy: @config.retry_policy
|
290
288
|
|
291
289
|
@adaptation_stub.call_rpc :get_phrase_set, request, options: options do |response, operation|
|
@@ -364,7 +362,9 @@ module Google
|
|
364
362
|
options.apply_defaults timeout: @config.rpcs.list_phrase_set.timeout,
|
365
363
|
metadata: metadata,
|
366
364
|
retry_policy: @config.rpcs.list_phrase_set.retry_policy
|
367
|
-
|
365
|
+
|
366
|
+
options.apply_defaults timeout: @config.timeout,
|
367
|
+
metadata: @config.metadata,
|
368
368
|
retry_policy: @config.retry_policy
|
369
369
|
|
370
370
|
@adaptation_stub.call_rpc :list_phrase_set, request, options: options do |response, operation|
|
@@ -437,7 +437,9 @@ module Google
|
|
437
437
|
options.apply_defaults timeout: @config.rpcs.update_phrase_set.timeout,
|
438
438
|
metadata: metadata,
|
439
439
|
retry_policy: @config.rpcs.update_phrase_set.retry_policy
|
440
|
-
|
440
|
+
|
441
|
+
options.apply_defaults timeout: @config.timeout,
|
442
|
+
metadata: @config.metadata,
|
441
443
|
retry_policy: @config.retry_policy
|
442
444
|
|
443
445
|
@adaptation_stub.call_rpc :update_phrase_set, request, options: options do |response, operation|
|
@@ -505,7 +507,9 @@ module Google
|
|
505
507
|
options.apply_defaults timeout: @config.rpcs.delete_phrase_set.timeout,
|
506
508
|
metadata: metadata,
|
507
509
|
retry_policy: @config.rpcs.delete_phrase_set.retry_policy
|
508
|
-
|
510
|
+
|
511
|
+
options.apply_defaults timeout: @config.timeout,
|
512
|
+
metadata: @config.metadata,
|
509
513
|
retry_policy: @config.retry_policy
|
510
514
|
|
511
515
|
@adaptation_stub.call_rpc :delete_phrase_set, request, options: options do |response, operation|
|
@@ -539,7 +543,7 @@ module Google
|
|
539
543
|
# Format:
|
540
544
|
# \\{api_version}/projects/\\{project}/locations/\\{location}/customClasses
|
541
545
|
# @param custom_class_id [::String]
|
542
|
-
# The ID to use for the custom class, which will become the final
|
546
|
+
# Required. The ID to use for the custom class, which will become the final
|
543
547
|
# component of the custom class' resource name.
|
544
548
|
#
|
545
549
|
# This value should be 4-63 characters, and valid characters
|
@@ -581,7 +585,9 @@ module Google
|
|
581
585
|
options.apply_defaults timeout: @config.rpcs.create_custom_class.timeout,
|
582
586
|
metadata: metadata,
|
583
587
|
retry_policy: @config.rpcs.create_custom_class.retry_policy
|
584
|
-
|
588
|
+
|
589
|
+
options.apply_defaults timeout: @config.timeout,
|
590
|
+
metadata: @config.metadata,
|
585
591
|
retry_policy: @config.retry_policy
|
586
592
|
|
587
593
|
@adaptation_stub.call_rpc :create_custom_class, request, options: options do |response, operation|
|
@@ -649,7 +655,9 @@ module Google
|
|
649
655
|
options.apply_defaults timeout: @config.rpcs.get_custom_class.timeout,
|
650
656
|
metadata: metadata,
|
651
657
|
retry_policy: @config.rpcs.get_custom_class.retry_policy
|
652
|
-
|
658
|
+
|
659
|
+
options.apply_defaults timeout: @config.timeout,
|
660
|
+
metadata: @config.metadata,
|
653
661
|
retry_policy: @config.retry_policy
|
654
662
|
|
655
663
|
@adaptation_stub.call_rpc :get_custom_class, request, options: options do |response, operation|
|
@@ -728,7 +736,9 @@ module Google
|
|
728
736
|
options.apply_defaults timeout: @config.rpcs.list_custom_classes.timeout,
|
729
737
|
metadata: metadata,
|
730
738
|
retry_policy: @config.rpcs.list_custom_classes.retry_policy
|
731
|
-
|
739
|
+
|
740
|
+
options.apply_defaults timeout: @config.timeout,
|
741
|
+
metadata: @config.metadata,
|
732
742
|
retry_policy: @config.retry_policy
|
733
743
|
|
734
744
|
@adaptation_stub.call_rpc :list_custom_classes, request, options: options do |response, operation|
|
@@ -801,7 +811,9 @@ module Google
|
|
801
811
|
options.apply_defaults timeout: @config.rpcs.update_custom_class.timeout,
|
802
812
|
metadata: metadata,
|
803
813
|
retry_policy: @config.rpcs.update_custom_class.retry_policy
|
804
|
-
|
814
|
+
|
815
|
+
options.apply_defaults timeout: @config.timeout,
|
816
|
+
metadata: @config.metadata,
|
805
817
|
retry_policy: @config.retry_policy
|
806
818
|
|
807
819
|
@adaptation_stub.call_rpc :update_custom_class, request, options: options do |response, operation|
|
@@ -869,7 +881,9 @@ module Google
|
|
869
881
|
options.apply_defaults timeout: @config.rpcs.delete_custom_class.timeout,
|
870
882
|
metadata: metadata,
|
871
883
|
retry_policy: @config.rpcs.delete_custom_class.retry_policy
|
872
|
-
|
884
|
+
|
885
|
+
options.apply_defaults timeout: @config.timeout,
|
886
|
+
metadata: @config.metadata,
|
873
887
|
retry_policy: @config.retry_policy
|
874
888
|
|
875
889
|
@adaptation_stub.call_rpc :delete_custom_class, request, options: options do |response, operation|
|
@@ -893,22 +907,21 @@ module Google
|
|
893
907
|
# Configuration can be applied globally to all clients, or to a single client
|
894
908
|
# on construction.
|
895
909
|
#
|
896
|
-
#
|
897
|
-
#
|
898
|
-
#
|
899
|
-
# to 20 seconds,
|
900
|
-
#
|
901
|
-
#
|
902
|
-
#
|
903
|
-
#
|
904
|
-
#
|
905
|
-
#
|
906
|
-
#
|
907
|
-
#
|
908
|
-
#
|
909
|
-
#
|
910
|
-
#
|
911
|
-
# end
|
910
|
+
# @example
|
911
|
+
#
|
912
|
+
# # Modify the global config, setting the timeout for
|
913
|
+
# # create_phrase_set to 20 seconds,
|
914
|
+
# # and all remaining timeouts to 10 seconds.
|
915
|
+
# ::Google::Cloud::Speech::V1p1beta1::Adaptation::Client.configure do |config|
|
916
|
+
# config.timeout = 10.0
|
917
|
+
# config.rpcs.create_phrase_set.timeout = 20.0
|
918
|
+
# end
|
919
|
+
#
|
920
|
+
# # Apply the above configuration only to a new client.
|
921
|
+
# client = ::Google::Cloud::Speech::V1p1beta1::Adaptation::Client.new do |config|
|
922
|
+
# config.timeout = 10.0
|
923
|
+
# config.rpcs.create_phrase_set.timeout = 20.0
|
924
|
+
# end
|
912
925
|
#
|
913
926
|
# @!attribute [rw] endpoint
|
914
927
|
# The hostname or hostname:port of the service endpoint.
|
@@ -50,6 +50,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
50
50
|
optional :max_alternatives, :int32, 4
|
51
51
|
optional :profanity_filter, :bool, 5
|
52
52
|
optional :adaptation, :message, 20, "google.cloud.speech.v1p1beta1.SpeechAdaptation"
|
53
|
+
optional :transcript_normalization, :message, 24, "google.cloud.speech.v1p1beta1.TranscriptNormalization"
|
53
54
|
repeated :speech_contexts, :message, 6, "google.cloud.speech.v1p1beta1.SpeechContext"
|
54
55
|
optional :enable_word_time_offsets, :bool, 8
|
55
56
|
optional :enable_word_confidence, :bool, 15
|
@@ -135,9 +136,11 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
135
136
|
end
|
136
137
|
add_message "google.cloud.speech.v1p1beta1.RecognizeResponse" do
|
137
138
|
repeated :results, :message, 2, "google.cloud.speech.v1p1beta1.SpeechRecognitionResult"
|
139
|
+
optional :total_billed_time, :message, 3, "google.protobuf.Duration"
|
138
140
|
end
|
139
141
|
add_message "google.cloud.speech.v1p1beta1.LongRunningRecognizeResponse" do
|
140
142
|
repeated :results, :message, 2, "google.cloud.speech.v1p1beta1.SpeechRecognitionResult"
|
143
|
+
optional :total_billed_time, :message, 3, "google.protobuf.Duration"
|
141
144
|
optional :output_config, :message, 6, "google.cloud.speech.v1p1beta1.TranscriptOutputConfig"
|
142
145
|
optional :output_error, :message, 7, "google.rpc.Status"
|
143
146
|
end
|
@@ -152,6 +155,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
152
155
|
optional :error, :message, 1, "google.rpc.Status"
|
153
156
|
repeated :results, :message, 2, "google.cloud.speech.v1p1beta1.StreamingRecognitionResult"
|
154
157
|
optional :speech_event_type, :enum, 4, "google.cloud.speech.v1p1beta1.StreamingRecognizeResponse.SpeechEventType"
|
158
|
+
optional :total_billed_time, :message, 5, "google.protobuf.Duration"
|
155
159
|
end
|
156
160
|
add_enum "google.cloud.speech.v1p1beta1.StreamingRecognizeResponse.SpeechEventType" do
|
157
161
|
value :SPEECH_EVENT_UNSPECIFIED, 0
|
@@ -4,6 +4,7 @@
|
|
4
4
|
require 'google/protobuf'
|
5
5
|
|
6
6
|
require 'google/api/resource_pb'
|
7
|
+
require 'google/protobuf/timestamp_pb'
|
7
8
|
require 'google/api/annotations_pb'
|
8
9
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
10
|
add_file("google/cloud/speech/v1p1beta1/resource.proto", :syntax => :proto3) do
|
@@ -29,6 +30,14 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
29
30
|
repeated :phrase_set_references, :string, 2
|
30
31
|
repeated :custom_classes, :message, 3, "google.cloud.speech.v1p1beta1.CustomClass"
|
31
32
|
end
|
33
|
+
add_message "google.cloud.speech.v1p1beta1.TranscriptNormalization" do
|
34
|
+
repeated :entries, :message, 1, "google.cloud.speech.v1p1beta1.TranscriptNormalization.Entry"
|
35
|
+
end
|
36
|
+
add_message "google.cloud.speech.v1p1beta1.TranscriptNormalization.Entry" do
|
37
|
+
optional :search, :string, 1
|
38
|
+
optional :replace, :string, 2
|
39
|
+
optional :case_sensitive, :bool, 3
|
40
|
+
end
|
32
41
|
end
|
33
42
|
end
|
34
43
|
|
@@ -41,6 +50,8 @@ module Google
|
|
41
50
|
PhraseSet = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1p1beta1.PhraseSet").msgclass
|
42
51
|
PhraseSet::Phrase = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1p1beta1.PhraseSet.Phrase").msgclass
|
43
52
|
SpeechAdaptation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1p1beta1.SpeechAdaptation").msgclass
|
53
|
+
TranscriptNormalization = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1p1beta1.TranscriptNormalization").msgclass
|
54
|
+
TranscriptNormalization::Entry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1p1beta1.TranscriptNormalization.Entry").msgclass
|
44
55
|
end
|
45
56
|
end
|
46
57
|
end
|
@@ -41,13 +41,12 @@ module Google
|
|
41
41
|
# See {::Google::Cloud::Speech::V1p1beta1::Speech::Client::Configuration}
|
42
42
|
# for a description of the configuration fields.
|
43
43
|
#
|
44
|
-
#
|
44
|
+
# @example
|
45
45
|
#
|
46
|
-
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
# end
|
46
|
+
# # Modify the configuration for all Speech clients
|
47
|
+
# ::Google::Cloud::Speech::V1p1beta1::Speech::Client.configure do |config|
|
48
|
+
# config.timeout = 10.0
|
49
|
+
# end
|
51
50
|
#
|
52
51
|
# @yield [config] Configure the Client client.
|
53
52
|
# @yieldparam config [Client::Configuration]
|
@@ -67,20 +66,14 @@ module Google
|
|
67
66
|
|
68
67
|
default_config.rpcs.recognize.timeout = 5000.0
|
69
68
|
default_config.rpcs.recognize.retry_policy = {
|
70
|
-
initial_delay: 0.1,
|
71
|
-
max_delay: 60.0,
|
72
|
-
multiplier: 1.3,
|
73
|
-
retry_codes: [4, 14]
|
69
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
74
70
|
}
|
75
71
|
|
76
72
|
default_config.rpcs.long_running_recognize.timeout = 5000.0
|
77
73
|
|
78
74
|
default_config.rpcs.streaming_recognize.timeout = 5000.0
|
79
75
|
default_config.rpcs.streaming_recognize.retry_policy = {
|
80
|
-
initial_delay: 0.1,
|
81
|
-
max_delay: 60.0,
|
82
|
-
multiplier: 1.3,
|
83
|
-
retry_codes: [4, 14]
|
76
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
84
77
|
}
|
85
78
|
|
86
79
|
default_config
|
@@ -112,19 +105,15 @@ module Google
|
|
112
105
|
##
|
113
106
|
# Create a new Speech client object.
|
114
107
|
#
|
115
|
-
#
|
116
|
-
#
|
117
|
-
# To create a new Speech client with the default
|
118
|
-
# configuration:
|
119
|
-
#
|
120
|
-
# client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
108
|
+
# @example
|
121
109
|
#
|
122
|
-
#
|
123
|
-
#
|
110
|
+
# # Create a client using the default configuration
|
111
|
+
# client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
124
112
|
#
|
125
|
-
#
|
126
|
-
#
|
127
|
-
#
|
113
|
+
# # Create a client using a custom configuration
|
114
|
+
# client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new do |config|
|
115
|
+
# config.timeout = 10.0
|
116
|
+
# end
|
128
117
|
#
|
129
118
|
# @yield [config] Configure the Speech client.
|
130
119
|
# @yieldparam config [Client::Configuration]
|
@@ -144,14 +133,13 @@ module Google
|
|
144
133
|
|
145
134
|
# Create credentials
|
146
135
|
credentials = @config.credentials
|
147
|
-
# Use self-signed JWT if the
|
136
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
148
137
|
# but only if the default endpoint does not have a region prefix.
|
149
|
-
enable_self_signed_jwt = @config.
|
150
|
-
@config.endpoint == Client.configure.endpoint &&
|
138
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
151
139
|
!@config.endpoint.split(".").first.include?("-")
|
152
140
|
credentials ||= Credentials.default scope: @config.scope,
|
153
141
|
enable_self_signed_jwt: enable_self_signed_jwt
|
154
|
-
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
142
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
155
143
|
credentials = Credentials.new credentials, scope: @config.scope
|
156
144
|
end
|
157
145
|
@quota_project_id = @config.quota_project
|
@@ -233,7 +221,9 @@ module Google
|
|
233
221
|
options.apply_defaults timeout: @config.rpcs.recognize.timeout,
|
234
222
|
metadata: metadata,
|
235
223
|
retry_policy: @config.rpcs.recognize.retry_policy
|
236
|
-
|
224
|
+
|
225
|
+
options.apply_defaults timeout: @config.timeout,
|
226
|
+
metadata: @config.metadata,
|
237
227
|
retry_policy: @config.retry_policy
|
238
228
|
|
239
229
|
@speech_stub.call_rpc :recognize, request, options: options do |response, operation|
|
@@ -303,7 +293,9 @@ module Google
|
|
303
293
|
options.apply_defaults timeout: @config.rpcs.long_running_recognize.timeout,
|
304
294
|
metadata: metadata,
|
305
295
|
retry_policy: @config.rpcs.long_running_recognize.retry_policy
|
306
|
-
|
296
|
+
|
297
|
+
options.apply_defaults timeout: @config.timeout,
|
298
|
+
metadata: @config.metadata,
|
307
299
|
retry_policy: @config.retry_policy
|
308
300
|
|
309
301
|
@speech_stub.call_rpc :long_running_recognize, request, options: options do |response, operation|
|
@@ -357,7 +349,9 @@ module Google
|
|
357
349
|
options.apply_defaults timeout: @config.rpcs.streaming_recognize.timeout,
|
358
350
|
metadata: metadata,
|
359
351
|
retry_policy: @config.rpcs.streaming_recognize.retry_policy
|
360
|
-
|
352
|
+
|
353
|
+
options.apply_defaults timeout: @config.timeout,
|
354
|
+
metadata: @config.metadata,
|
361
355
|
retry_policy: @config.retry_policy
|
362
356
|
|
363
357
|
@speech_stub.call_rpc :streaming_recognize, request, options: options do |response, operation|
|
@@ -381,22 +375,21 @@ module Google
|
|
381
375
|
# Configuration can be applied globally to all clients, or to a single client
|
382
376
|
# on construction.
|
383
377
|
#
|
384
|
-
#
|
385
|
-
#
|
386
|
-
#
|
387
|
-
# to 20 seconds,
|
388
|
-
#
|
389
|
-
#
|
390
|
-
#
|
391
|
-
#
|
392
|
-
#
|
393
|
-
#
|
394
|
-
#
|
395
|
-
#
|
396
|
-
#
|
397
|
-
#
|
398
|
-
#
|
399
|
-
# end
|
378
|
+
# @example
|
379
|
+
#
|
380
|
+
# # Modify the global config, setting the timeout for
|
381
|
+
# # recognize to 20 seconds,
|
382
|
+
# # and all remaining timeouts to 10 seconds.
|
383
|
+
# ::Google::Cloud::Speech::V1p1beta1::Speech::Client.configure do |config|
|
384
|
+
# config.timeout = 10.0
|
385
|
+
# config.rpcs.recognize.timeout = 20.0
|
386
|
+
# end
|
387
|
+
#
|
388
|
+
# # Apply the above configuration only to a new client.
|
389
|
+
# client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new do |config|
|
390
|
+
# config.timeout = 10.0
|
391
|
+
# config.rpcs.recognize.timeout = 20.0
|
392
|
+
# end
|
400
393
|
#
|
401
394
|
# @!attribute [rw] endpoint
|
402
395
|
# The hostname or hostname:port of the service endpoint.
|
@@ -82,7 +82,7 @@ module Google
|
|
82
82
|
# Create credentials
|
83
83
|
credentials = @config.credentials
|
84
84
|
credentials ||= Credentials.default scope: @config.scope
|
85
|
-
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
85
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
86
86
|
credentials = Credentials.new credentials, scope: @config.scope
|
87
87
|
end
|
88
88
|
@quota_project_id = @config.quota_project
|
@@ -169,7 +169,9 @@ module Google
|
|
169
169
|
options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
|
170
170
|
metadata: metadata,
|
171
171
|
retry_policy: @config.rpcs.list_operations.retry_policy
|
172
|
-
|
172
|
+
|
173
|
+
options.apply_defaults timeout: @config.timeout,
|
174
|
+
metadata: @config.metadata,
|
173
175
|
retry_policy: @config.retry_policy
|
174
176
|
|
175
177
|
@operations_stub.call_rpc :list_operations, request, options: options do |response, operation|
|
@@ -239,7 +241,9 @@ module Google
|
|
239
241
|
options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
|
240
242
|
metadata: metadata,
|
241
243
|
retry_policy: @config.rpcs.get_operation.retry_policy
|
242
|
-
|
244
|
+
|
245
|
+
options.apply_defaults timeout: @config.timeout,
|
246
|
+
metadata: @config.metadata,
|
243
247
|
retry_policy: @config.retry_policy
|
244
248
|
|
245
249
|
@operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
|
@@ -309,7 +313,9 @@ module Google
|
|
309
313
|
options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
|
310
314
|
metadata: metadata,
|
311
315
|
retry_policy: @config.rpcs.delete_operation.retry_policy
|
312
|
-
|
316
|
+
|
317
|
+
options.apply_defaults timeout: @config.timeout,
|
318
|
+
metadata: @config.metadata,
|
313
319
|
retry_policy: @config.retry_policy
|
314
320
|
|
315
321
|
@operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
|
@@ -384,7 +390,9 @@ module Google
|
|
384
390
|
options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
|
385
391
|
metadata: metadata,
|
386
392
|
retry_policy: @config.rpcs.cancel_operation.retry_policy
|
387
|
-
|
393
|
+
|
394
|
+
options.apply_defaults timeout: @config.timeout,
|
395
|
+
metadata: @config.metadata,
|
388
396
|
retry_policy: @config.retry_policy
|
389
397
|
|
390
398
|
@operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
|
@@ -396,9 +404,9 @@ module Google
|
|
396
404
|
end
|
397
405
|
|
398
406
|
##
|
399
|
-
# Waits
|
400
|
-
#
|
401
|
-
#
|
407
|
+
# Waits until the specified long-running operation is done or reaches at most
|
408
|
+
# a specified timeout, returning the latest state. If the operation is
|
409
|
+
# already done, the latest state is immediately returned. If the timeout
|
402
410
|
# specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
|
403
411
|
# timeout is used. If the server does not support this method, it returns
|
404
412
|
# `google.rpc.Code.UNIMPLEMENTED`.
|
@@ -456,7 +464,9 @@ module Google
|
|
456
464
|
options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
|
457
465
|
metadata: metadata,
|
458
466
|
retry_policy: @config.rpcs.wait_operation.retry_policy
|
459
|
-
|
467
|
+
|
468
|
+
options.apply_defaults timeout: @config.timeout,
|
469
|
+
metadata: @config.metadata,
|
460
470
|
retry_policy: @config.retry_policy
|
461
471
|
|
462
472
|
@operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
|
@@ -481,22 +491,21 @@ module Google
|
|
481
491
|
# Configuration can be applied globally to all clients, or to a single client
|
482
492
|
# on construction.
|
483
493
|
#
|
484
|
-
#
|
485
|
-
#
|
486
|
-
#
|
487
|
-
# to 20 seconds,
|
488
|
-
#
|
489
|
-
#
|
490
|
-
#
|
491
|
-
#
|
492
|
-
#
|
493
|
-
#
|
494
|
-
#
|
495
|
-
#
|
496
|
-
#
|
497
|
-
#
|
498
|
-
#
|
499
|
-
# end
|
494
|
+
# @example
|
495
|
+
#
|
496
|
+
# # Modify the global config, setting the timeout for
|
497
|
+
# # list_operations to 20 seconds,
|
498
|
+
# # and all remaining timeouts to 10 seconds.
|
499
|
+
# ::Google::Longrunning::Operations::Client.configure do |config|
|
500
|
+
# config.timeout = 10.0
|
501
|
+
# config.rpcs.list_operations.timeout = 20.0
|
502
|
+
# end
|
503
|
+
#
|
504
|
+
# # Apply the above configuration only to a new client.
|
505
|
+
# client = ::Google::Longrunning::Operations::Client.new do |config|
|
506
|
+
# config.timeout = 10.0
|
507
|
+
# config.rpcs.list_operations.timeout = 20.0
|
508
|
+
# end
|
500
509
|
#
|
501
510
|
# @!attribute [rw] endpoint
|
502
511
|
# The hostname or hostname:port of the service endpoint.
|
@@ -57,9 +57,15 @@ module Google
|
|
57
57
|
|
58
58
|
# Denotes that a (repeated) field is an unordered list.
|
59
59
|
# This indicates that the service may provide the elements of the list
|
60
|
-
# in any arbitrary
|
60
|
+
# in any arbitrary order, rather than the order the user originally
|
61
61
|
# provided. Additionally, the list's order may or may not be stable.
|
62
62
|
UNORDERED_LIST = 6
|
63
|
+
|
64
|
+
# Denotes that this field returns a non-empty default value if not set.
|
65
|
+
# This indicates that if the user provides the empty value in a request,
|
66
|
+
# a non-empty value will be returned. The user will not be aware of what
|
67
|
+
# non-empty value to expect.
|
68
|
+
NON_EMPTY_DEFAULT = 7
|
63
69
|
end
|
64
70
|
end
|
65
71
|
end
|
@@ -205,6 +205,12 @@ module Google
|
|
205
205
|
# `speech_contexts` field. For more information, see the [speech
|
206
206
|
# adaptation](https://cloud.google.com/speech-to-text/docs/adaptation)
|
207
207
|
# documentation.
|
208
|
+
# @!attribute [rw] transcript_normalization
|
209
|
+
# @return [::Google::Cloud::Speech::V1p1beta1::TranscriptNormalization]
|
210
|
+
# Use transcription normalization to automatically replace parts of the
|
211
|
+
# transcript with phrases of your choosing. For StreamingRecognize, this
|
212
|
+
# normalization only applies to stable partial transcripts (stability > 0.8)
|
213
|
+
# and final transcripts.
|
208
214
|
# @!attribute [rw] speech_contexts
|
209
215
|
# @return [::Array<::Google::Cloud::Speech::V1p1beta1::SpeechContext>]
|
210
216
|
# Array of {::Google::Cloud::Speech::V1p1beta1::SpeechContext SpeechContext}.
|
@@ -616,6 +622,9 @@ module Google
|
|
616
622
|
# @return [::Array<::Google::Cloud::Speech::V1p1beta1::SpeechRecognitionResult>]
|
617
623
|
# Sequential list of transcription results corresponding to
|
618
624
|
# sequential portions of audio.
|
625
|
+
# @!attribute [rw] total_billed_time
|
626
|
+
# @return [::Google::Protobuf::Duration]
|
627
|
+
# When available, billed audio seconds for the corresponding request.
|
619
628
|
class RecognizeResponse
|
620
629
|
include ::Google::Protobuf::MessageExts
|
621
630
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
@@ -630,6 +639,9 @@ module Google
|
|
630
639
|
# @return [::Array<::Google::Cloud::Speech::V1p1beta1::SpeechRecognitionResult>]
|
631
640
|
# Sequential list of transcription results corresponding to
|
632
641
|
# sequential portions of audio.
|
642
|
+
# @!attribute [rw] total_billed_time
|
643
|
+
# @return [::Google::Protobuf::Duration]
|
644
|
+
# When available, billed audio seconds for the corresponding request.
|
633
645
|
# @!attribute [rw] output_config
|
634
646
|
# @return [::Google::Cloud::Speech::V1p1beta1::TranscriptOutputConfig]
|
635
647
|
# Original output config if present in the request.
|
@@ -728,6 +740,10 @@ module Google
|
|
728
740
|
# @!attribute [rw] speech_event_type
|
729
741
|
# @return [::Google::Cloud::Speech::V1p1beta1::StreamingRecognizeResponse::SpeechEventType]
|
730
742
|
# Indicates the type of speech event.
|
743
|
+
# @!attribute [rw] total_billed_time
|
744
|
+
# @return [::Google::Protobuf::Duration]
|
745
|
+
# When available, billed audio seconds for the stream.
|
746
|
+
# Set only if this is the last response in the stream.
|
731
747
|
class StreamingRecognizeResponse
|
732
748
|
include ::Google::Protobuf::MessageExts
|
733
749
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
@@ -29,7 +29,7 @@ module Google
|
|
29
29
|
# \\{api_version}/projects/\\{project}/locations/\\{location}/phraseSets
|
30
30
|
# @!attribute [rw] phrase_set_id
|
31
31
|
# @return [::String]
|
32
|
-
# The ID to use for the phrase set, which will become the final
|
32
|
+
# Required. The ID to use for the phrase set, which will become the final
|
33
33
|
# component of the phrase set's resource name.
|
34
34
|
#
|
35
35
|
# This value should be 4-63 characters, and valid characters
|
@@ -125,7 +125,7 @@ module Google
|
|
125
125
|
# \\{api_version}/projects/\\{project}/locations/\\{location}/customClasses
|
126
126
|
# @!attribute [rw] custom_class_id
|
127
127
|
# @return [::String]
|
128
|
-
# The ID to use for the custom class, which will become the final
|
128
|
+
# Required. The ID to use for the custom class, which will become the final
|
129
129
|
# component of the custom class' resource name.
|
130
130
|
#
|
131
131
|
# This value should be 4-63 characters, and valid characters
|
@@ -130,6 +130,36 @@ module Google
|
|
130
130
|
include ::Google::Protobuf::MessageExts
|
131
131
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
132
132
|
end
|
133
|
+
|
134
|
+
# Transcription normalization configuration. Use transcription normalization
|
135
|
+
# to automatically replace parts of the transcript with phrases of your
|
136
|
+
# choosing. For StreamingRecognize, this normalization only applies to stable
|
137
|
+
# partial transcripts (stability > 0.8) and final transcripts.
|
138
|
+
# @!attribute [rw] entries
|
139
|
+
# @return [::Array<::Google::Cloud::Speech::V1p1beta1::TranscriptNormalization::Entry>]
|
140
|
+
# A list of replacement entries. We will perform replacement with one entry
|
141
|
+
# at a time. For example, the second entry in ["cat" => "dog", "mountain cat"
|
142
|
+
# => "mountain dog"] will never be applied because we will always process the
|
143
|
+
# first entry before it. At most 100 entries.
|
144
|
+
class TranscriptNormalization
|
145
|
+
include ::Google::Protobuf::MessageExts
|
146
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
147
|
+
|
148
|
+
# A single replacement configuration.
|
149
|
+
# @!attribute [rw] search
|
150
|
+
# @return [::String]
|
151
|
+
# What to replace. Max length is 100 characters.
|
152
|
+
# @!attribute [rw] replace
|
153
|
+
# @return [::String]
|
154
|
+
# What to replace with. Max length is 100 characters.
|
155
|
+
# @!attribute [rw] case_sensitive
|
156
|
+
# @return [::Boolean]
|
157
|
+
# Whether the search is case sensitive.
|
158
|
+
class Entry
|
159
|
+
include ::Google::Protobuf::MessageExts
|
160
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
161
|
+
end
|
162
|
+
end
|
133
163
|
end
|
134
164
|
end
|
135
165
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-speech-v1p1beta1
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gapic-common
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.7'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 2.a
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0.
|
29
|
+
version: '0.7'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 2.a
|