google-cloud-media_translation-v1beta1 0.3.0 → 0.4.3
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 +0 -4
- data/lib/google/cloud/media_translation/v1beta1/speech_translation_service/client.rb +34 -42
- data/lib/google/cloud/media_translation/v1beta1/version.rb +1 -1
- data/lib/google/cloud/mediatranslation/v1beta1/media_translation_pb.rb +0 -3
- data/proto_docs/google/api/field_behavior.rb +7 -1
- data/proto_docs/google/cloud/mediatranslation/v1beta1/media_translation.rb +34 -23
- metadata +13 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56583c9e663369515513dd29f3534e3a439d58d89ede1060d56457763fb7b0db
|
4
|
+
data.tar.gz: 46db844c9c88e15551b2dbdeee206b75b3090c369cc886e27617fbe0e278d667
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1978e12874fd9f39dcb1ebe65f3d075f67bc85b72d31075ad64d32e5d71c8f2ff15fa7b9248f882d742844aa08b9ff30044551139a51f757f04ec9ef0aa3bb19
|
7
|
+
data.tar.gz: e005affeefd6ff61558c0e3e37811e997fc21bdbc6117fb998f1a201ce36093f03a16a1633d74700c1dc15feef1c2a271a0ff67c83b7f8f690d9b5fe831ec41a
|
data/AUTHENTICATION.md
CHANGED
@@ -66,11 +66,11 @@ The environment variables that google-cloud-media_translation-v1beta1
|
|
66
66
|
checks for credentials are configured on the service Credentials class (such as
|
67
67
|
{::Google::Cloud::MediaTranslation::V1beta1::SpeechTranslationService::Credentials}):
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
69
|
+
* `MEDIA_TRANSLATION_CREDENTIALS` - Path to JSON file, or JSON contents
|
70
|
+
* `MEDIA_TRANSLATION_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/media_translation/v1beta1"
|
@@ -82,8 +82,8 @@ client = ::Google::Cloud::MediaTranslation::V1beta1::SpeechTranslationService::C
|
|
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/media_translation/v1beta1"
|
@@ -93,7 +93,7 @@ client = ::Google::Cloud::MediaTranslation::V1beta1::SpeechTranslationService::C
|
|
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/media_translation/v1beta1"
|
data/README.md
CHANGED
@@ -31,10 +31,6 @@ In order to use this library, you first need to go through the following steps:
|
|
31
31
|
|
32
32
|
```ruby
|
33
33
|
require "google/cloud/media_translation/v1beta1"
|
34
|
-
|
35
|
-
client = ::Google::Cloud::MediaTranslation::V1beta1::SpeechTranslationService::Client.new
|
36
|
-
request = my_create_request
|
37
|
-
response = client.streaming_translate_speech request
|
38
34
|
```
|
39
35
|
|
40
36
|
View the [Client Library Documentation](https://googleapis.dev/ruby/google-cloud-media_translation-v1beta1/latest)
|
@@ -39,13 +39,12 @@ module Google
|
|
39
39
|
# See {::Google::Cloud::MediaTranslation::V1beta1::SpeechTranslationService::Client::Configuration}
|
40
40
|
# for a description of the configuration fields.
|
41
41
|
#
|
42
|
-
#
|
42
|
+
# @example
|
43
43
|
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
47
|
-
#
|
48
|
-
# end
|
44
|
+
# # Modify the configuration for all SpeechTranslationService clients
|
45
|
+
# ::Google::Cloud::MediaTranslation::V1beta1::SpeechTranslationService::Client.configure do |config|
|
46
|
+
# config.timeout = 10.0
|
47
|
+
# end
|
49
48
|
#
|
50
49
|
# @yield [config] Configure the Client client.
|
51
50
|
# @yieldparam config [Client::Configuration]
|
@@ -65,10 +64,7 @@ module Google
|
|
65
64
|
|
66
65
|
default_config.timeout = 400.0
|
67
66
|
default_config.retry_policy = {
|
68
|
-
initial_delay: 1.0,
|
69
|
-
max_delay: 60.0,
|
70
|
-
multiplier: 1.3,
|
71
|
-
retry_codes: [14, 2, 4]
|
67
|
+
initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 2, 4]
|
72
68
|
}
|
73
69
|
|
74
70
|
default_config.rpcs.streaming_translate_speech.timeout = 400.0
|
@@ -102,19 +98,15 @@ module Google
|
|
102
98
|
##
|
103
99
|
# Create a new SpeechTranslationService client object.
|
104
100
|
#
|
105
|
-
#
|
106
|
-
#
|
107
|
-
# To create a new SpeechTranslationService client with the default
|
108
|
-
# configuration:
|
101
|
+
# @example
|
109
102
|
#
|
110
|
-
#
|
103
|
+
# # Create a client using the default configuration
|
104
|
+
# client = ::Google::Cloud::MediaTranslation::V1beta1::SpeechTranslationService::Client.new
|
111
105
|
#
|
112
|
-
#
|
113
|
-
#
|
114
|
-
#
|
115
|
-
#
|
116
|
-
# config.timeout = 10.0
|
117
|
-
# end
|
106
|
+
# # Create a client using a custom configuration
|
107
|
+
# client = ::Google::Cloud::MediaTranslation::V1beta1::SpeechTranslationService::Client.new do |config|
|
108
|
+
# config.timeout = 10.0
|
109
|
+
# end
|
118
110
|
#
|
119
111
|
# @yield [config] Configure the SpeechTranslationService client.
|
120
112
|
# @yieldparam config [Client::Configuration]
|
@@ -134,14 +126,13 @@ module Google
|
|
134
126
|
|
135
127
|
# Create credentials
|
136
128
|
credentials = @config.credentials
|
137
|
-
# Use self-signed JWT if the
|
129
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
138
130
|
# but only if the default endpoint does not have a region prefix.
|
139
|
-
enable_self_signed_jwt = @config.
|
140
|
-
@config.endpoint == Client.configure.endpoint &&
|
131
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
141
132
|
!@config.endpoint.split(".").first.include?("-")
|
142
133
|
credentials ||= Credentials.default scope: @config.scope,
|
143
134
|
enable_self_signed_jwt: enable_self_signed_jwt
|
144
|
-
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
135
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
145
136
|
credentials = Credentials.new credentials, scope: @config.scope
|
146
137
|
end
|
147
138
|
@quota_project_id = @config.quota_project
|
@@ -200,7 +191,9 @@ module Google
|
|
200
191
|
options.apply_defaults timeout: @config.rpcs.streaming_translate_speech.timeout,
|
201
192
|
metadata: metadata,
|
202
193
|
retry_policy: @config.rpcs.streaming_translate_speech.retry_policy
|
203
|
-
|
194
|
+
|
195
|
+
options.apply_defaults timeout: @config.timeout,
|
196
|
+
metadata: @config.metadata,
|
204
197
|
retry_policy: @config.retry_policy
|
205
198
|
|
206
199
|
@speech_translation_service_stub.call_rpc :streaming_translate_speech, request, options: options do |response, operation|
|
@@ -224,22 +217,21 @@ module Google
|
|
224
217
|
# Configuration can be applied globally to all clients, or to a single client
|
225
218
|
# on construction.
|
226
219
|
#
|
227
|
-
#
|
228
|
-
#
|
229
|
-
#
|
230
|
-
# to 20 seconds,
|
231
|
-
#
|
232
|
-
#
|
233
|
-
#
|
234
|
-
#
|
235
|
-
#
|
236
|
-
#
|
237
|
-
#
|
238
|
-
#
|
239
|
-
#
|
240
|
-
#
|
241
|
-
#
|
242
|
-
# end
|
220
|
+
# @example
|
221
|
+
#
|
222
|
+
# # Modify the global config, setting the timeout for
|
223
|
+
# # streaming_translate_speech to 20 seconds,
|
224
|
+
# # and all remaining timeouts to 10 seconds.
|
225
|
+
# ::Google::Cloud::MediaTranslation::V1beta1::SpeechTranslationService::Client.configure do |config|
|
226
|
+
# config.timeout = 10.0
|
227
|
+
# config.rpcs.streaming_translate_speech.timeout = 20.0
|
228
|
+
# end
|
229
|
+
#
|
230
|
+
# # Apply the above configuration only to a new client.
|
231
|
+
# client = ::Google::Cloud::MediaTranslation::V1beta1::SpeechTranslationService::Client.new do |config|
|
232
|
+
# config.timeout = 10.0
|
233
|
+
# config.rpcs.streaming_translate_speech.timeout = 20.0
|
234
|
+
# end
|
243
235
|
#
|
244
236
|
# @!attribute [rw] endpoint
|
245
237
|
# The hostname or hostname:port of the service endpoint.
|
@@ -11,7 +11,6 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
11
11
|
add_message "google.cloud.mediatranslation.v1beta1.TranslateSpeechConfig" do
|
12
12
|
optional :audio_encoding, :string, 1
|
13
13
|
optional :source_language_code, :string, 2
|
14
|
-
repeated :alternative_source_language_codes, :string, 6
|
15
14
|
optional :target_language_code, :string, 3
|
16
15
|
optional :sample_rate_hertz, :int32, 4
|
17
16
|
optional :model, :string, 5
|
@@ -27,7 +26,6 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
27
26
|
end
|
28
27
|
end
|
29
28
|
add_message "google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResult" do
|
30
|
-
optional :recognition_result, :string, 3
|
31
29
|
oneof :result do
|
32
30
|
optional :text_translation_result, :message, 1, "google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResult.TextTranslationResult"
|
33
31
|
end
|
@@ -35,7 +33,6 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
35
33
|
add_message "google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResult.TextTranslationResult" do
|
36
34
|
optional :translation, :string, 1
|
37
35
|
optional :is_final, :bool, 2
|
38
|
-
optional :detected_source_language_code, :string, 3
|
39
36
|
end
|
40
37
|
add_message "google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResponse" do
|
41
38
|
optional :error, :message, 1, "google.rpc.Status"
|
@@ -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
|
@@ -31,17 +31,39 @@ module Google
|
|
31
31
|
# - `linear16`
|
32
32
|
#
|
33
33
|
# Uncompressed 16-bit signed little-endian samples (Linear PCM).
|
34
|
+
#
|
35
|
+
# - `flac`
|
36
|
+
#
|
37
|
+
# `flac` (Free Lossless Audio Codec) is the recommended encoding
|
38
|
+
# because it is lossless--therefore recognition is not compromised--and
|
39
|
+
# requires only about half the bandwidth of `linear16`.
|
40
|
+
#
|
41
|
+
# - `mulaw`
|
42
|
+
#
|
43
|
+
# 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law.
|
44
|
+
#
|
45
|
+
# - `amr`
|
46
|
+
#
|
47
|
+
# Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000.
|
48
|
+
#
|
49
|
+
# - `amr-wb`
|
50
|
+
#
|
51
|
+
# Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000.
|
52
|
+
#
|
53
|
+
# - `ogg-opus`
|
54
|
+
#
|
55
|
+
# Opus encoded audio frames in [Ogg](https://wikipedia.org/wiki/Ogg)
|
56
|
+
# container. `sample_rate_hertz` must be one of 8000, 12000, 16000, 24000,
|
57
|
+
# or 48000.
|
58
|
+
#
|
59
|
+
# - `mp3`
|
60
|
+
#
|
61
|
+
# MP3 audio. Support all standard MP3 bitrates (which range from 32-320
|
62
|
+
# kbps). When using this encoding, `sample_rate_hertz` has to match the
|
63
|
+
# sample rate of the file being used.
|
34
64
|
# @!attribute [rw] source_language_code
|
35
65
|
# @return [::String]
|
36
66
|
# Required. Source language code (BCP-47) of the input audio.
|
37
|
-
# @!attribute [rw] alternative_source_language_codes
|
38
|
-
# @return [::Array<::String>]
|
39
|
-
# Optional. A list of up to 3 additional language codes (BCP-47), listing possible
|
40
|
-
# alternative languages of the supplied audio. If alternative source
|
41
|
-
# languages are listed, speech translation result will translate in the most
|
42
|
-
# likely language detected including the main source_language_code. The
|
43
|
-
# translated result will include the language code of the language detected
|
44
|
-
# in the audio.
|
45
67
|
# @!attribute [rw] target_language_code
|
46
68
|
# @return [::String]
|
47
69
|
# Required. Target language code (BCP-47) of the output.
|
@@ -50,11 +72,12 @@ module Google
|
|
50
72
|
# Optional. Sample rate in Hertz of the audio data. Valid values are:
|
51
73
|
# 8000-48000. 16000 is optimal. For best results, set the sampling rate of
|
52
74
|
# the audio source to 16000 Hz. If that's not possible, use the native sample
|
53
|
-
# rate of the audio source (instead of re-sampling).
|
54
|
-
# omitted for `FLAC` and `WAV` audio files.
|
75
|
+
# rate of the audio source (instead of re-sampling).
|
55
76
|
# @!attribute [rw] model
|
56
77
|
# @return [::String]
|
57
|
-
# Optional.
|
78
|
+
# Optional. `google-provided-model/video` and
|
79
|
+
# `google-provided-model/enhanced-phone-call` are premium models.
|
80
|
+
# `google-provided-model/phone-call` is not premium model.
|
58
81
|
class TranslateSpeechConfig
|
59
82
|
include ::Google::Protobuf::MessageExts
|
60
83
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
@@ -115,13 +138,6 @@ module Google
|
|
115
138
|
# @!attribute [rw] text_translation_result
|
116
139
|
# @return [::Google::Cloud::MediaTranslation::V1beta1::StreamingTranslateSpeechResult::TextTranslationResult]
|
117
140
|
# Text translation result.
|
118
|
-
# @!attribute [r] recognition_result
|
119
|
-
# @return [::String]
|
120
|
-
# Output only. The debug only recognition result in original language. This field is debug
|
121
|
-
# only and will be set to empty string if not available.
|
122
|
-
# This is implementation detail and will not be backward compatible.
|
123
|
-
#
|
124
|
-
# Still need to decide whether to expose this field by default.
|
125
141
|
class StreamingTranslateSpeechResult
|
126
142
|
include ::Google::Protobuf::MessageExts
|
127
143
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
@@ -138,11 +154,6 @@ module Google
|
|
138
154
|
# `StreamingTranslateSpeechResult`, the streaming translator will not
|
139
155
|
# return any further hypotheses for this portion of the transcript and
|
140
156
|
# corresponding audio.
|
141
|
-
# @!attribute [r] detected_source_language_code
|
142
|
-
# @return [::String]
|
143
|
-
# Output only. The source language code (BCP-47) detected in the audio. Speech
|
144
|
-
# translation result will translate in the most likely language detected
|
145
|
-
# including the alternative source languages and main source_language_code.
|
146
157
|
class TextTranslationResult
|
147
158
|
include ::Google::Protobuf::MessageExts
|
148
159
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-media_translation-v1beta1
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3
|
4
|
+
version: 0.4.3
|
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-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gapic-common
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.7'
|
20
|
+
- - "<"
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
22
|
+
version: 2.a
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.7'
|
30
|
+
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
32
|
+
version: 2.a
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: google-cloud-errors
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -201,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
207
|
- !ruby/object:Gem::Version
|
202
208
|
version: '0'
|
203
209
|
requirements: []
|
204
|
-
rubygems_version: 3.2.
|
210
|
+
rubygems_version: 3.2.17
|
205
211
|
signing_key:
|
206
212
|
specification_version: 4
|
207
213
|
summary: API Client library for the Media Translation V1beta1 API
|