google-cloud-speech 0.30.0 → 0.30.1
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 +4 -4
- data/.yardopts +2 -1
- data/README.md +21 -17
- data/lib/google/cloud/speech.rb +27 -2
- data/lib/google/cloud/speech/v1.rb +71 -46
- data/lib/google/cloud/speech/v1/credentials.rb +10 -2
- data/lib/google/cloud/speech/v1/doc/google/cloud/speech/v1/cloud_speech.rb +0 -11
- data/lib/google/cloud/speech/v1/doc/overview.rb +26 -1
- data/lib/google/cloud/speech/v1/speech_client.rb +11 -4
- data/lib/google/cloud/speech/v1p1beta1.rb +71 -46
- data/lib/google/cloud/speech/v1p1beta1/cloud_speech_pb.rb +12 -0
- data/lib/google/cloud/speech/v1p1beta1/credentials.rb +10 -2
- data/lib/google/cloud/speech/v1p1beta1/doc/google/cloud/speech/v1p1beta1/cloud_speech.rb +91 -11
- data/lib/google/cloud/speech/v1p1beta1/doc/overview.rb +27 -2
- data/lib/google/cloud/speech/v1p1beta1/speech_client.rb +11 -4
- metadata +34 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8972d84300ec92b1d15550149a9ef0e6a5c22dbea4fc7f5acd5671cb46423c0b
|
4
|
+
data.tar.gz: 4626226bd0faaa8f814db8e2bf85ac4d2a2990a28c9fda0f38077f3b5e128e28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e95686eaf7e849eceeff434d087733015e565cdf19d1ee7bfafc721549b648f6b0edd03544c5851a7c1760fe63926c8a2a73d4bbc977270d1ba849129a20db7
|
7
|
+
data.tar.gz: 3ef81a3b9e99bd463d3afb0902830ca083a6b7916fe70bd50d630e1fbee419ad10d3aaf588982d39fcba90227126941fefe2a184b969da8c33370d24cba060e8
|
data/.yardopts
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
# Ruby Client for Cloud Speech API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
|
1
|
+
# Ruby Client for Google Cloud Speech API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
|
2
2
|
|
3
|
-
[Cloud Speech API][Product Documentation]:
|
4
|
-
|
3
|
+
[Google Cloud Speech API][Product Documentation]:
|
4
|
+
Google Cloud Speech API.
|
5
5
|
- [Client Library Documentation][]
|
6
6
|
- [Product Documentation][]
|
7
7
|
|
@@ -11,7 +11,7 @@ steps:
|
|
11
11
|
|
12
12
|
1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
13
13
|
2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
14
|
-
3. [Enable the Cloud Speech API.](https://console.cloud.google.com/apis/
|
14
|
+
3. [Enable the Google Cloud Speech API.](https://console.cloud.google.com/apis/library/speech.googleapis.com)
|
15
15
|
4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
16
16
|
|
17
17
|
### Installation
|
@@ -46,16 +46,23 @@ response = speech_client.recognize(config, audio)
|
|
46
46
|
```
|
47
47
|
|
48
48
|
### Next Steps
|
49
|
-
- Read the [Client Library Documentation][] for Cloud Speech API
|
49
|
+
- Read the [Client Library Documentation][] for Google Cloud Speech API
|
50
50
|
to see other available methods on the client.
|
51
|
-
- Read the [Cloud Speech API Product documentation][Product Documentation]
|
51
|
+
- Read the [Google Cloud Speech API Product documentation][Product Documentation]
|
52
52
|
to learn more about the product and see How-to Guides.
|
53
53
|
- View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
|
54
54
|
to see the full list of Cloud APIs that we cover.
|
55
55
|
|
56
|
+
[Client Library Documentation]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-speech/latest/google/cloud/speech/v1
|
57
|
+
[Product Documentation]: https://cloud.google.com/speech
|
58
|
+
|
56
59
|
## Enabling Logging
|
57
60
|
|
58
|
-
To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
61
|
+
To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
62
|
+
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
63
|
+
or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
|
64
|
+
that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
65
|
+
and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
59
66
|
|
60
67
|
Configuring a Ruby stdlib logger:
|
61
68
|
|
@@ -77,14 +84,11 @@ end
|
|
77
84
|
|
78
85
|
## Supported Ruby Versions
|
79
86
|
|
80
|
-
This library is supported on Ruby 2.
|
87
|
+
This library is supported on Ruby 2.3+.
|
81
88
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
[Client Library Documentation]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-speech/latest/google/cloud/speech
|
90
|
-
[Product Documentation]: https://cloud.google.com/speech
|
89
|
+
Google provides official support for Ruby versions that are actively supported
|
90
|
+
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
91
|
+
in security maintenance, and not end of life. Currently, this means Ruby 2.3
|
92
|
+
and later. Older versions of Ruby _may_ still work, but are unsupported and not
|
93
|
+
recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
|
94
|
+
about the Ruby support schedule.
|
data/lib/google/cloud/speech.rb
CHANGED
@@ -32,7 +32,7 @@ module Google
|
|
32
32
|
#
|
33
33
|
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
34
34
|
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
35
|
-
# 3. [Enable the Google Cloud Speech API.](https://console.cloud.google.com/apis/
|
35
|
+
# 3. [Enable the Google Cloud Speech API.](https://console.cloud.google.com/apis/library/speech.googleapis.com)
|
36
36
|
# 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
37
37
|
#
|
38
38
|
# ### Migration Guide
|
@@ -56,7 +56,7 @@ module Google
|
|
56
56
|
# sample_rate_hertz: sample_rate_hertz,
|
57
57
|
# encoding: encoding
|
58
58
|
# }
|
59
|
-
# uri = "gs://
|
59
|
+
# uri = "gs://bucket-name/hello.flac"
|
60
60
|
# audio = { uri: uri }
|
61
61
|
# response = speech_client.recognize(config, audio)
|
62
62
|
# ```
|
@@ -69,6 +69,31 @@ module Google
|
|
69
69
|
#
|
70
70
|
# [Product Documentation]: https://cloud.google.com/speech
|
71
71
|
#
|
72
|
+
# ## Enabling Logging
|
73
|
+
#
|
74
|
+
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
75
|
+
# The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
76
|
+
# or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
|
77
|
+
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
78
|
+
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
79
|
+
#
|
80
|
+
# Configuring a Ruby stdlib logger:
|
81
|
+
#
|
82
|
+
# ```ruby
|
83
|
+
# require "logger"
|
84
|
+
#
|
85
|
+
# module MyLogger
|
86
|
+
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
87
|
+
# def logger
|
88
|
+
# LOGGER
|
89
|
+
# end
|
90
|
+
# end
|
91
|
+
#
|
92
|
+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
93
|
+
# module GRPC
|
94
|
+
# extend MyLogger
|
95
|
+
# end
|
96
|
+
# ```
|
72
97
|
#
|
73
98
|
module Speech
|
74
99
|
# rubocop:enable LineLength
|
@@ -17,53 +17,78 @@ require "google/cloud/speech/v1/helpers"
|
|
17
17
|
|
18
18
|
module Google
|
19
19
|
module Cloud
|
20
|
-
# rubocop:disable LineLength
|
21
|
-
|
22
|
-
##
|
23
|
-
# # Ruby Client for Google Cloud Speech API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
|
24
|
-
#
|
25
|
-
# [Google Cloud Speech API][Product Documentation]:
|
26
|
-
# Google Cloud Speech API.
|
27
|
-
# - [Product Documentation][]
|
28
|
-
#
|
29
|
-
# ## Quick Start
|
30
|
-
# In order to use this library, you first need to go through the following
|
31
|
-
# steps:
|
32
|
-
#
|
33
|
-
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
34
|
-
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
35
|
-
# 3. [Enable the Google Cloud Speech API.](https://console.cloud.google.com/apis/api/speech)
|
36
|
-
# 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
37
|
-
#
|
38
|
-
# ### Preview
|
39
|
-
# #### SpeechClient
|
40
|
-
# ```rb
|
41
|
-
# require "google/cloud/speech/v1"
|
42
|
-
#
|
43
|
-
# speech_client = Google::Cloud::Speech::V1.new
|
44
|
-
# language_code = "en-US"
|
45
|
-
# sample_rate_hertz = 44100
|
46
|
-
# encoding = :FLAC
|
47
|
-
# config = {
|
48
|
-
# language_code: language_code,
|
49
|
-
# sample_rate_hertz: sample_rate_hertz,
|
50
|
-
# encoding: encoding
|
51
|
-
# }
|
52
|
-
# uri = "gs://gapic-toolkit/hello.flac"
|
53
|
-
# audio = { uri: uri }
|
54
|
-
# response = speech_client.recognize(config, audio)
|
55
|
-
# ```
|
56
|
-
#
|
57
|
-
# ### Next Steps
|
58
|
-
# - Read the [Google Cloud Speech API Product documentation][Product Documentation]
|
59
|
-
# to learn more about the product and see How-to Guides.
|
60
|
-
# - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
|
61
|
-
# to see the full list of Cloud APIs that we cover.
|
62
|
-
#
|
63
|
-
# [Product Documentation]: https://cloud.google.com/speech
|
64
|
-
#
|
65
|
-
#
|
66
20
|
module Speech
|
21
|
+
# rubocop:disable LineLength
|
22
|
+
|
23
|
+
##
|
24
|
+
# # Ruby Client for Google Cloud Speech API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
|
25
|
+
#
|
26
|
+
# [Google Cloud Speech API][Product Documentation]:
|
27
|
+
# Google Cloud Speech API.
|
28
|
+
# - [Product Documentation][]
|
29
|
+
#
|
30
|
+
# ## Quick Start
|
31
|
+
# In order to use this library, you first need to go through the following
|
32
|
+
# steps:
|
33
|
+
#
|
34
|
+
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
35
|
+
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
36
|
+
# 3. [Enable the Google Cloud Speech API.](https://console.cloud.google.com/apis/library/speech.googleapis.com)
|
37
|
+
# 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
38
|
+
#
|
39
|
+
# ### Preview
|
40
|
+
# #### SpeechClient
|
41
|
+
# ```rb
|
42
|
+
# require "google/cloud/speech"
|
43
|
+
#
|
44
|
+
# speech_client = Google::Cloud::Speech.new(version: :v1)
|
45
|
+
# language_code = "en-US"
|
46
|
+
# sample_rate_hertz = 44100
|
47
|
+
# encoding = :FLAC
|
48
|
+
# config = {
|
49
|
+
# language_code: language_code,
|
50
|
+
# sample_rate_hertz: sample_rate_hertz,
|
51
|
+
# encoding: encoding
|
52
|
+
# }
|
53
|
+
# uri = "gs://bucket-name/hello.flac"
|
54
|
+
# audio = { uri: uri }
|
55
|
+
# response = speech_client.recognize(config, audio)
|
56
|
+
# ```
|
57
|
+
#
|
58
|
+
# ### Next Steps
|
59
|
+
# - Read the [Google Cloud Speech API Product documentation][Product Documentation]
|
60
|
+
# to learn more about the product and see How-to Guides.
|
61
|
+
# - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
|
62
|
+
# to see the full list of Cloud APIs that we cover.
|
63
|
+
#
|
64
|
+
# [Product Documentation]: https://cloud.google.com/speech
|
65
|
+
#
|
66
|
+
# ## Enabling Logging
|
67
|
+
#
|
68
|
+
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
69
|
+
# The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
70
|
+
# or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
|
71
|
+
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
72
|
+
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
73
|
+
#
|
74
|
+
# Configuring a Ruby stdlib logger:
|
75
|
+
#
|
76
|
+
# ```ruby
|
77
|
+
# require "logger"
|
78
|
+
#
|
79
|
+
# module MyLogger
|
80
|
+
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
81
|
+
# def logger
|
82
|
+
# LOGGER
|
83
|
+
# end
|
84
|
+
# end
|
85
|
+
#
|
86
|
+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
87
|
+
# module GRPC
|
88
|
+
# extend MyLogger
|
89
|
+
# end
|
90
|
+
# ```
|
91
|
+
#
|
67
92
|
module V1
|
68
93
|
# rubocop:enable LineLength
|
69
94
|
|
@@ -22,8 +22,16 @@ module Google
|
|
22
22
|
SCOPE = [
|
23
23
|
"https://www.googleapis.com/auth/cloud-platform"
|
24
24
|
].freeze
|
25
|
-
PATH_ENV_VARS = %w(
|
26
|
-
|
25
|
+
PATH_ENV_VARS = %w(SPEECH_CREDENTIALS
|
26
|
+
SPEECH_KEYFILE
|
27
|
+
GOOGLE_CLOUD_CREDENTIALS
|
28
|
+
GOOGLE_CLOUD_KEYFILE
|
29
|
+
GCLOUD_KEYFILE)
|
30
|
+
JSON_ENV_VARS = %w(SPEECH_CREDENTIALS_JSON
|
31
|
+
SPEECH_KEYFILE_JSON
|
32
|
+
GOOGLE_CLOUD_CREDENTIALS_JSON
|
33
|
+
GOOGLE_CLOUD_KEYFILE_JSON
|
34
|
+
GCLOUD_KEYFILE_JSON)
|
27
35
|
DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
|
28
36
|
end
|
29
37
|
end
|
@@ -15,17 +15,6 @@
|
|
15
15
|
module Google
|
16
16
|
module Cloud
|
17
17
|
module Speech
|
18
|
-
##
|
19
|
-
# # Google Cloud Speech API Contents
|
20
|
-
#
|
21
|
-
# | Class | Description |
|
22
|
-
# | ----- | ----------- |
|
23
|
-
# | [SpeechClient][] | Service that implements Google Cloud Speech API. |
|
24
|
-
# | [Data Types][] | Data types for Google::Cloud::Speech::V1 |
|
25
|
-
#
|
26
|
-
# [SpeechClient]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-speech/latest/google/cloud/speech/v1/speechclient
|
27
|
-
# [Data Types]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-speech/latest/google/cloud/speech/v1/datatypes
|
28
|
-
#
|
29
18
|
module V1
|
30
19
|
# The top-level message sent by the client for the +Recognize+ method.
|
31
20
|
# @!attribute [rw] config
|
@@ -29,7 +29,7 @@ module Google
|
|
29
29
|
#
|
30
30
|
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
31
31
|
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
32
|
-
# 3. [Enable the Google Cloud Speech API.](https://console.cloud.google.com/apis/
|
32
|
+
# 3. [Enable the Google Cloud Speech API.](https://console.cloud.google.com/apis/library/speech.googleapis.com)
|
33
33
|
# 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
34
34
|
#
|
35
35
|
# ### Installation
|
@@ -64,6 +64,31 @@ module Google
|
|
64
64
|
#
|
65
65
|
# [Product Documentation]: https://cloud.google.com/speech
|
66
66
|
#
|
67
|
+
# ## Enabling Logging
|
68
|
+
#
|
69
|
+
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
70
|
+
# The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
71
|
+
# or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
|
72
|
+
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
73
|
+
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
74
|
+
#
|
75
|
+
# Configuring a Ruby stdlib logger:
|
76
|
+
#
|
77
|
+
# ```ruby
|
78
|
+
# require "logger"
|
79
|
+
#
|
80
|
+
# module MyLogger
|
81
|
+
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
82
|
+
# def logger
|
83
|
+
# LOGGER
|
84
|
+
# end
|
85
|
+
# end
|
86
|
+
#
|
87
|
+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
88
|
+
# module GRPC
|
89
|
+
# extend MyLogger
|
90
|
+
# end
|
91
|
+
# ```
|
67
92
|
#
|
68
93
|
module Speech
|
69
94
|
module V1
|
@@ -46,6 +46,9 @@ module Google
|
|
46
46
|
# The default port of the service.
|
47
47
|
DEFAULT_SERVICE_PORT = 443
|
48
48
|
|
49
|
+
# The default set of gRPC interceptors.
|
50
|
+
GRPC_INTERCEPTORS = []
|
51
|
+
|
49
52
|
DEFAULT_TIMEOUT = 30
|
50
53
|
|
51
54
|
# The scopes needed to make gRPC calls to all of the methods defined in
|
@@ -54,8 +57,10 @@ module Google
|
|
54
57
|
"https://www.googleapis.com/auth/cloud-platform"
|
55
58
|
].freeze
|
56
59
|
|
60
|
+
# @private
|
57
61
|
class OperationsClient < Google::Longrunning::OperationsClient
|
58
62
|
self::SERVICE_ADDRESS = SpeechClient::SERVICE_ADDRESS
|
63
|
+
self::GRPC_INTERCEPTORS = SpeechClient::GRPC_INTERCEPTORS
|
59
64
|
end
|
60
65
|
|
61
66
|
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
@@ -157,6 +162,7 @@ module Google
|
|
157
162
|
# Allow overriding the service path/port in subclasses.
|
158
163
|
service_path = self.class::SERVICE_ADDRESS
|
159
164
|
port = self.class::DEFAULT_SERVICE_PORT
|
165
|
+
interceptors = self.class::GRPC_INTERCEPTORS
|
160
166
|
@speech_stub = Google::Gax::Grpc.create_stub(
|
161
167
|
service_path,
|
162
168
|
port,
|
@@ -164,6 +170,7 @@ module Google
|
|
164
170
|
channel: channel,
|
165
171
|
updater_proc: updater_proc,
|
166
172
|
scopes: scopes,
|
173
|
+
interceptors: interceptors,
|
167
174
|
&Google::Cloud::Speech::V1::Speech::Stub.method(:new)
|
168
175
|
)
|
169
176
|
|
@@ -207,9 +214,9 @@ module Google
|
|
207
214
|
# @return [Google::Cloud::Speech::V1::RecognizeResponse]
|
208
215
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
209
216
|
# @example
|
210
|
-
# require "google/cloud/speech
|
217
|
+
# require "google/cloud/speech"
|
211
218
|
#
|
212
|
-
# speech_client = Google::Cloud::Speech
|
219
|
+
# speech_client = Google::Cloud::Speech.new(version: :v1)
|
213
220
|
# encoding = :FLAC
|
214
221
|
# sample_rate_hertz = 44100
|
215
222
|
# language_code = "en-US"
|
@@ -255,9 +262,9 @@ module Google
|
|
255
262
|
# @return [Google::Gax::Operation]
|
256
263
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
257
264
|
# @example
|
258
|
-
# require "google/cloud/speech
|
265
|
+
# require "google/cloud/speech"
|
259
266
|
#
|
260
|
-
# speech_client = Google::Cloud::Speech
|
267
|
+
# speech_client = Google::Cloud::Speech.new(version: :v1)
|
261
268
|
# encoding = :FLAC
|
262
269
|
# sample_rate_hertz = 44100
|
263
270
|
# language_code = "en-US"
|
@@ -17,53 +17,78 @@ require "google/cloud/speech/v1p1beta1/helpers"
|
|
17
17
|
|
18
18
|
module Google
|
19
19
|
module Cloud
|
20
|
-
# rubocop:disable LineLength
|
21
|
-
|
22
|
-
##
|
23
|
-
# # Ruby Client for Cloud Speech API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
|
24
|
-
#
|
25
|
-
# [Cloud Speech API][Product Documentation]:
|
26
|
-
# Converts audio to text by applying powerful neural network models.
|
27
|
-
# - [Product Documentation][]
|
28
|
-
#
|
29
|
-
# ## Quick Start
|
30
|
-
# In order to use this library, you first need to go through the following
|
31
|
-
# steps:
|
32
|
-
#
|
33
|
-
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
34
|
-
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
35
|
-
# 3. [Enable the Cloud Speech API.](https://console.cloud.google.com/apis/api/speech)
|
36
|
-
# 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
37
|
-
#
|
38
|
-
# ### Preview
|
39
|
-
# #### SpeechClient
|
40
|
-
# ```rb
|
41
|
-
# require "google/cloud/speech/v1p1beta1"
|
42
|
-
#
|
43
|
-
# speech_client = Google::Cloud::Speech::V1p1beta1.new
|
44
|
-
# language_code = "en-US"
|
45
|
-
# sample_rate_hertz = 44100
|
46
|
-
# encoding = :FLAC
|
47
|
-
# config = {
|
48
|
-
# language_code: language_code,
|
49
|
-
# sample_rate_hertz: sample_rate_hertz,
|
50
|
-
# encoding: encoding
|
51
|
-
# }
|
52
|
-
# uri = "gs://gapic-toolkit/hello.flac"
|
53
|
-
# audio = { uri: uri }
|
54
|
-
# response = speech_client.recognize(config, audio)
|
55
|
-
# ```
|
56
|
-
#
|
57
|
-
# ### Next Steps
|
58
|
-
# - Read the [Cloud Speech API Product documentation][Product Documentation]
|
59
|
-
# to learn more about the product and see How-to Guides.
|
60
|
-
# - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
|
61
|
-
# to see the full list of Cloud APIs that we cover.
|
62
|
-
#
|
63
|
-
# [Product Documentation]: https://cloud.google.com/speech
|
64
|
-
#
|
65
|
-
#
|
66
20
|
module Speech
|
21
|
+
# rubocop:disable LineLength
|
22
|
+
|
23
|
+
##
|
24
|
+
# # Ruby Client for Cloud Speech API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
|
25
|
+
#
|
26
|
+
# [Cloud Speech API][Product Documentation]:
|
27
|
+
# Converts audio to text by applying powerful neural network models.
|
28
|
+
# - [Product Documentation][]
|
29
|
+
#
|
30
|
+
# ## Quick Start
|
31
|
+
# In order to use this library, you first need to go through the following
|
32
|
+
# steps:
|
33
|
+
#
|
34
|
+
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
35
|
+
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
36
|
+
# 3. [Enable the Cloud Speech API.](https://console.cloud.google.com/apis/library/speech.googleapis.com)
|
37
|
+
# 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
38
|
+
#
|
39
|
+
# ### Preview
|
40
|
+
# #### SpeechClient
|
41
|
+
# ```rb
|
42
|
+
# require "google/cloud/speech"
|
43
|
+
#
|
44
|
+
# speech_client = Google::Cloud::Speech.new(version: :v1p1beta1)
|
45
|
+
# language_code = "en-US"
|
46
|
+
# sample_rate_hertz = 44100
|
47
|
+
# encoding = :FLAC
|
48
|
+
# config = {
|
49
|
+
# language_code: language_code,
|
50
|
+
# sample_rate_hertz: sample_rate_hertz,
|
51
|
+
# encoding: encoding
|
52
|
+
# }
|
53
|
+
# uri = "gs://bucket-name/hello.flac"
|
54
|
+
# audio = { uri: uri }
|
55
|
+
# response = speech_client.recognize(config, audio)
|
56
|
+
# ```
|
57
|
+
#
|
58
|
+
# ### Next Steps
|
59
|
+
# - Read the [Cloud Speech API Product documentation][Product Documentation]
|
60
|
+
# to learn more about the product and see How-to Guides.
|
61
|
+
# - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
|
62
|
+
# to see the full list of Cloud APIs that we cover.
|
63
|
+
#
|
64
|
+
# [Product Documentation]: https://cloud.google.com/speech
|
65
|
+
#
|
66
|
+
# ## Enabling Logging
|
67
|
+
#
|
68
|
+
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
69
|
+
# The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
70
|
+
# or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
|
71
|
+
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
72
|
+
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
73
|
+
#
|
74
|
+
# Configuring a Ruby stdlib logger:
|
75
|
+
#
|
76
|
+
# ```ruby
|
77
|
+
# require "logger"
|
78
|
+
#
|
79
|
+
# module MyLogger
|
80
|
+
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
81
|
+
# def logger
|
82
|
+
# LOGGER
|
83
|
+
# end
|
84
|
+
# end
|
85
|
+
#
|
86
|
+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
87
|
+
# module GRPC
|
88
|
+
# extend MyLogger
|
89
|
+
# end
|
90
|
+
# ```
|
91
|
+
#
|
67
92
|
module V1p1beta1
|
68
93
|
# rubocop:enable LineLength
|
69
94
|
|
@@ -32,12 +32,18 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
32
32
|
add_message "google.cloud.speech.v1p1beta1.RecognitionConfig" do
|
33
33
|
optional :encoding, :enum, 1, "google.cloud.speech.v1p1beta1.RecognitionConfig.AudioEncoding"
|
34
34
|
optional :sample_rate_hertz, :int32, 2
|
35
|
+
optional :audio_channel_count, :int32, 7
|
36
|
+
optional :enable_separate_recognition_per_channel, :bool, 12
|
35
37
|
optional :language_code, :string, 3
|
38
|
+
repeated :alternative_language_codes, :string, 18
|
36
39
|
optional :max_alternatives, :int32, 4
|
37
40
|
optional :profanity_filter, :bool, 5
|
38
41
|
repeated :speech_contexts, :message, 6, "google.cloud.speech.v1p1beta1.SpeechContext"
|
39
42
|
optional :enable_word_time_offsets, :bool, 8
|
43
|
+
optional :enable_word_confidence, :bool, 15
|
40
44
|
optional :enable_automatic_punctuation, :bool, 11
|
45
|
+
optional :enable_speaker_diarization, :bool, 16
|
46
|
+
optional :diarization_speaker_count, :int32, 17
|
41
47
|
optional :metadata, :message, 9, "google.cloud.speech.v1p1beta1.RecognitionMetadata"
|
42
48
|
optional :model, :string, 13
|
43
49
|
optional :use_enhanced, :bool, 14
|
@@ -127,9 +133,13 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
127
133
|
repeated :alternatives, :message, 1, "google.cloud.speech.v1p1beta1.SpeechRecognitionAlternative"
|
128
134
|
optional :is_final, :bool, 2
|
129
135
|
optional :stability, :float, 3
|
136
|
+
optional :channel_tag, :int32, 5
|
137
|
+
optional :language_code, :string, 6
|
130
138
|
end
|
131
139
|
add_message "google.cloud.speech.v1p1beta1.SpeechRecognitionResult" do
|
132
140
|
repeated :alternatives, :message, 1, "google.cloud.speech.v1p1beta1.SpeechRecognitionAlternative"
|
141
|
+
optional :channel_tag, :int32, 2
|
142
|
+
optional :language_code, :string, 5
|
133
143
|
end
|
134
144
|
add_message "google.cloud.speech.v1p1beta1.SpeechRecognitionAlternative" do
|
135
145
|
optional :transcript, :string, 1
|
@@ -140,6 +150,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
140
150
|
optional :start_time, :message, 1, "google.protobuf.Duration"
|
141
151
|
optional :end_time, :message, 2, "google.protobuf.Duration"
|
142
152
|
optional :word, :string, 3
|
153
|
+
optional :confidence, :float, 4
|
154
|
+
optional :speaker_tag, :int32, 5
|
143
155
|
end
|
144
156
|
end
|
145
157
|
|
@@ -22,8 +22,16 @@ module Google
|
|
22
22
|
SCOPE = [
|
23
23
|
"https://www.googleapis.com/auth/cloud-platform"
|
24
24
|
].freeze
|
25
|
-
PATH_ENV_VARS = %w(
|
26
|
-
|
25
|
+
PATH_ENV_VARS = %w(SPEECH_CREDENTIALS
|
26
|
+
SPEECH_KEYFILE
|
27
|
+
GOOGLE_CLOUD_CREDENTIALS
|
28
|
+
GOOGLE_CLOUD_KEYFILE
|
29
|
+
GCLOUD_KEYFILE)
|
30
|
+
JSON_ENV_VARS = %w(SPEECH_CREDENTIALS_JSON
|
31
|
+
SPEECH_KEYFILE_JSON
|
32
|
+
GOOGLE_CLOUD_CREDENTIALS_JSON
|
33
|
+
GOOGLE_CLOUD_KEYFILE_JSON
|
34
|
+
GCLOUD_KEYFILE_JSON)
|
27
35
|
DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
|
28
36
|
end
|
29
37
|
end
|
@@ -15,17 +15,6 @@
|
|
15
15
|
module Google
|
16
16
|
module Cloud
|
17
17
|
module Speech
|
18
|
-
##
|
19
|
-
# # Cloud Speech API Contents
|
20
|
-
#
|
21
|
-
# | Class | Description |
|
22
|
-
# | ----- | ----------- |
|
23
|
-
# | [SpeechClient][] | Service that implements Google Cloud Speech API. |
|
24
|
-
# | [Data Types][] | Data types for Google::Cloud::Speech::V1p1beta1 |
|
25
|
-
#
|
26
|
-
# [SpeechClient]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-speech/latest/google/cloud/speech/v1p1beta1/speechclient
|
27
|
-
# [Data Types]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-speech/latest/google/cloud/speech/v1p1beta1/datatypes
|
28
|
-
#
|
29
18
|
module V1p1beta1
|
30
19
|
# The top-level message sent by the client for the +Recognize+ method.
|
31
20
|
# @!attribute [rw] config
|
@@ -113,6 +102,25 @@ module Google
|
|
113
102
|
# the audio source (instead of re-sampling).
|
114
103
|
# This field is optional for +FLAC+ and +WAV+ audio files and required
|
115
104
|
# for all other audio formats. For details, see {Google::Cloud::Speech::V1p1beta1::RecognitionConfig::AudioEncoding AudioEncoding}.
|
105
|
+
# @!attribute [rw] audio_channel_count
|
106
|
+
# @return [Integer]
|
107
|
+
# *Optional* The number of channels in the input audio data.
|
108
|
+
# ONLY set this for MULTI-CHANNEL recognition.
|
109
|
+
# Valid values for LINEAR16 and FLAC are +1+-+8+.
|
110
|
+
# Valid values for OGG_OPUS are '1'-'254'.
|
111
|
+
# Valid value for MULAW, AMR, AMR_WB and SPEEX_WITH_HEADER_BYTE is only +1+.
|
112
|
+
# If +0+ or omitted, defaults to one channel (mono).
|
113
|
+
# NOTE: We only recognize the first channel by default.
|
114
|
+
# To perform independent recognition on each channel set
|
115
|
+
# enable_separate_recognition_per_channel to 'true'.
|
116
|
+
# @!attribute [rw] enable_separate_recognition_per_channel
|
117
|
+
# @return [true, false]
|
118
|
+
# This needs to be set to ‘true’ explicitly and audio_channel_count > 1
|
119
|
+
# to get each channel recognized separately. The recognition result will
|
120
|
+
# contain a channel_tag field to state which channel that result belongs to.
|
121
|
+
# If this is not ‘true’, we will only recognize the first channel.
|
122
|
+
# NOTE: The request is also billed cumulatively for all channels recognized:
|
123
|
+
# (audio_channel_count times the audio length)
|
116
124
|
# @!attribute [rw] language_code
|
117
125
|
# @return [String]
|
118
126
|
# *Required* The language of the supplied audio as a
|
@@ -120,6 +128,20 @@ module Google
|
|
120
128
|
# Example: "en-US".
|
121
129
|
# See [Language Support](https://cloud.google.com/speech/docs/languages)
|
122
130
|
# for a list of the currently supported language codes.
|
131
|
+
# @!attribute [rw] alternative_language_codes
|
132
|
+
# @return [Array<String>]
|
133
|
+
# *Optional* A list of up to 3 additional
|
134
|
+
# [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tags,
|
135
|
+
# listing possible alternative languages of the supplied audio.
|
136
|
+
# See [Language Support](https://cloud.google.com/speech/docs/languages)
|
137
|
+
# for a list of the currently supported language codes.
|
138
|
+
# If alternative languages are listed, recognition result will contain
|
139
|
+
# recognition in the most likely language detected including the main
|
140
|
+
# language_code. The recognition result will include the language tag
|
141
|
+
# of the language detected in the audio.
|
142
|
+
# NOTE: This feature is only supported for Voice Command and Voice Search
|
143
|
+
# use cases and performance may vary for other use cases (e.g., phone call
|
144
|
+
# transcription).
|
123
145
|
# @!attribute [rw] max_alternatives
|
124
146
|
# @return [Integer]
|
125
147
|
# *Optional* Maximum number of recognition hypotheses to be returned.
|
@@ -143,6 +165,11 @@ module Google
|
|
143
165
|
# the start and end time offsets (timestamps) for those words. If
|
144
166
|
# +false+, no word-level time offset information is returned. The default is
|
145
167
|
# +false+.
|
168
|
+
# @!attribute [rw] enable_word_confidence
|
169
|
+
# @return [true, false]
|
170
|
+
# *Optional* If +true+, the top result includes a list of words and the
|
171
|
+
# confidence for those words. If +false+, no word-level confidence
|
172
|
+
# information is returned. The default is +false+.
|
146
173
|
# @!attribute [rw] enable_automatic_punctuation
|
147
174
|
# @return [true, false]
|
148
175
|
# *Optional* If 'true', adds punctuation to recognition result hypotheses.
|
@@ -152,6 +179,21 @@ module Google
|
|
152
179
|
# NOTE: "This is currently offered as an experimental service, complimentary
|
153
180
|
# to all users. In the future this may be exclusively available as a
|
154
181
|
# premium feature."
|
182
|
+
# @!attribute [rw] enable_speaker_diarization
|
183
|
+
# @return [true, false]
|
184
|
+
# *Optional* If 'true', enables speaker detection for each recognized word in
|
185
|
+
# the top alternative of the recognition result using a speaker_tag provided
|
186
|
+
# in the WordInfo.
|
187
|
+
# Note: When this is true, we send all the words from the beginning of the
|
188
|
+
# audio for the top alternative in every consecutive responses.
|
189
|
+
# This is done in order to improve our speaker tags as our models learn to
|
190
|
+
# identify the speakers in the conversation over time.
|
191
|
+
# @!attribute [rw] diarization_speaker_count
|
192
|
+
# @return [Integer]
|
193
|
+
# *Optional*
|
194
|
+
# If set, specifies the estimated number of speakers in the conversation.
|
195
|
+
# If not set, defaults to '2'.
|
196
|
+
# Ignored unless enable_speaker_diarization is set to true."
|
155
197
|
# @!attribute [rw] metadata
|
156
198
|
# @return [Google::Cloud::Speech::V1p1beta1::RecognitionMetadata]
|
157
199
|
# *Optional* Metadata regarding this request.
|
@@ -567,6 +609,17 @@ module Google
|
|
567
609
|
# (completely unstable) to 1.0 (completely stable).
|
568
610
|
# This field is only provided for interim results (+is_final=false+).
|
569
611
|
# The default of 0.0 is a sentinel value indicating +stability+ was not set.
|
612
|
+
# @!attribute [rw] channel_tag
|
613
|
+
# @return [Integer]
|
614
|
+
# For multi-channel audio, this is the channel number corresponding to the
|
615
|
+
# recognized result for the audio from that channel.
|
616
|
+
# For audio_channel_count = N, its output values can range from '1' to 'N'.
|
617
|
+
# @!attribute [rw] language_code
|
618
|
+
# @return [String]
|
619
|
+
# Output only. The
|
620
|
+
# [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag of the
|
621
|
+
# language in this result. This language code was detected to have the most
|
622
|
+
# likelihood of being spoken in the audio.
|
570
623
|
class StreamingRecognitionResult; end
|
571
624
|
|
572
625
|
# A speech recognition result corresponding to a portion of the audio.
|
@@ -576,6 +629,17 @@ module Google
|
|
576
629
|
# maximum specified in +max_alternatives+).
|
577
630
|
# These alternatives are ordered in terms of accuracy, with the top (first)
|
578
631
|
# alternative being the most probable, as ranked by the recognizer.
|
632
|
+
# @!attribute [rw] channel_tag
|
633
|
+
# @return [Integer]
|
634
|
+
# For multi-channel audio, this is the channel number corresponding to the
|
635
|
+
# recognized result for the audio from that channel.
|
636
|
+
# For audio_channel_count = N, its output values can range from '1' to 'N'.
|
637
|
+
# @!attribute [rw] language_code
|
638
|
+
# @return [String]
|
639
|
+
# Output only. The
|
640
|
+
# [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag of the
|
641
|
+
# language in this result. This language code was detected to have the most
|
642
|
+
# likelihood of being spoken in the audio.
|
579
643
|
class SpeechRecognitionResult; end
|
580
644
|
|
581
645
|
# Alternative hypotheses (a.k.a. n-best list).
|
@@ -618,6 +682,22 @@ module Google
|
|
618
682
|
# @!attribute [rw] word
|
619
683
|
# @return [String]
|
620
684
|
# Output only. The word corresponding to this set of information.
|
685
|
+
# @!attribute [rw] confidence
|
686
|
+
# @return [Float]
|
687
|
+
# Output only. The confidence estimate between 0.0 and 1.0. A higher number
|
688
|
+
# indicates an estimated greater likelihood that the recognized words are
|
689
|
+
# correct. This field is set only for the top alternative of a non-streaming
|
690
|
+
# result or, of a streaming result where +is_final=true+.
|
691
|
+
# This field is not guaranteed to be accurate and users should not rely on it
|
692
|
+
# to be always provided.
|
693
|
+
# The default of 0.0 is a sentinel value indicating +confidence+ was not set.
|
694
|
+
# @!attribute [rw] speaker_tag
|
695
|
+
# @return [Integer]
|
696
|
+
# Output only. A distinct integer value is assigned for every speaker within
|
697
|
+
# the audio. This field specifies which one of those speakers was detected to
|
698
|
+
# have spoken this word. Value ranges from '1' to diarization_speaker_count.
|
699
|
+
# speaker_tag is set if enable_speaker_diarization = 'true' and only in the
|
700
|
+
# top alternative.
|
621
701
|
class WordInfo; end
|
622
702
|
end
|
623
703
|
end
|
@@ -29,7 +29,7 @@ module Google
|
|
29
29
|
#
|
30
30
|
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
31
31
|
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
32
|
-
# 3. [Enable the Cloud Speech API.](https://console.cloud.google.com/apis/
|
32
|
+
# 3. [Enable the Cloud Speech API.](https://console.cloud.google.com/apis/library/speech.googleapis.com)
|
33
33
|
# 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
34
34
|
#
|
35
35
|
# ### Installation
|
@@ -42,7 +42,7 @@ module Google
|
|
42
42
|
# ```rb
|
43
43
|
# require "google/cloud/speech"
|
44
44
|
#
|
45
|
-
# speech_client = Google::Cloud::Speech
|
45
|
+
# speech_client = Google::Cloud::Speech.new
|
46
46
|
# language_code = "en-US"
|
47
47
|
# sample_rate_hertz = 44100
|
48
48
|
# encoding = :FLAC
|
@@ -64,6 +64,31 @@ module Google
|
|
64
64
|
#
|
65
65
|
# [Product Documentation]: https://cloud.google.com/speech
|
66
66
|
#
|
67
|
+
# ## Enabling Logging
|
68
|
+
#
|
69
|
+
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
70
|
+
# The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
71
|
+
# or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
|
72
|
+
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
73
|
+
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
74
|
+
#
|
75
|
+
# Configuring a Ruby stdlib logger:
|
76
|
+
#
|
77
|
+
# ```ruby
|
78
|
+
# require "logger"
|
79
|
+
#
|
80
|
+
# module MyLogger
|
81
|
+
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
82
|
+
# def logger
|
83
|
+
# LOGGER
|
84
|
+
# end
|
85
|
+
# end
|
86
|
+
#
|
87
|
+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
88
|
+
# module GRPC
|
89
|
+
# extend MyLogger
|
90
|
+
# end
|
91
|
+
# ```
|
67
92
|
#
|
68
93
|
module Speech
|
69
94
|
module V1p1beta1
|
@@ -46,6 +46,9 @@ module Google
|
|
46
46
|
# The default port of the service.
|
47
47
|
DEFAULT_SERVICE_PORT = 443
|
48
48
|
|
49
|
+
# The default set of gRPC interceptors.
|
50
|
+
GRPC_INTERCEPTORS = []
|
51
|
+
|
49
52
|
DEFAULT_TIMEOUT = 30
|
50
53
|
|
51
54
|
# The scopes needed to make gRPC calls to all of the methods defined in
|
@@ -54,8 +57,10 @@ module Google
|
|
54
57
|
"https://www.googleapis.com/auth/cloud-platform"
|
55
58
|
].freeze
|
56
59
|
|
60
|
+
# @private
|
57
61
|
class OperationsClient < Google::Longrunning::OperationsClient
|
58
62
|
self::SERVICE_ADDRESS = SpeechClient::SERVICE_ADDRESS
|
63
|
+
self::GRPC_INTERCEPTORS = SpeechClient::GRPC_INTERCEPTORS
|
59
64
|
end
|
60
65
|
|
61
66
|
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
@@ -157,6 +162,7 @@ module Google
|
|
157
162
|
# Allow overriding the service path/port in subclasses.
|
158
163
|
service_path = self.class::SERVICE_ADDRESS
|
159
164
|
port = self.class::DEFAULT_SERVICE_PORT
|
165
|
+
interceptors = self.class::GRPC_INTERCEPTORS
|
160
166
|
@speech_stub = Google::Gax::Grpc.create_stub(
|
161
167
|
service_path,
|
162
168
|
port,
|
@@ -164,6 +170,7 @@ module Google
|
|
164
170
|
channel: channel,
|
165
171
|
updater_proc: updater_proc,
|
166
172
|
scopes: scopes,
|
173
|
+
interceptors: interceptors,
|
167
174
|
&Google::Cloud::Speech::V1p1beta1::Speech::Stub.method(:new)
|
168
175
|
)
|
169
176
|
|
@@ -207,9 +214,9 @@ module Google
|
|
207
214
|
# @return [Google::Cloud::Speech::V1p1beta1::RecognizeResponse]
|
208
215
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
209
216
|
# @example
|
210
|
-
# require "google/cloud/speech
|
217
|
+
# require "google/cloud/speech"
|
211
218
|
#
|
212
|
-
# speech_client = Google::Cloud::Speech
|
219
|
+
# speech_client = Google::Cloud::Speech.new(version: :v1p1beta1)
|
213
220
|
# encoding = :FLAC
|
214
221
|
# sample_rate_hertz = 44100
|
215
222
|
# language_code = "en-US"
|
@@ -255,9 +262,9 @@ module Google
|
|
255
262
|
# @return [Google::Gax::Operation]
|
256
263
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
257
264
|
# @example
|
258
|
-
# require "google/cloud/speech
|
265
|
+
# require "google/cloud/speech"
|
259
266
|
#
|
260
|
-
# speech_client = Google::Cloud::Speech
|
267
|
+
# speech_client = Google::Cloud::Speech.new(version: :v1p1beta1)
|
261
268
|
# encoding = :FLAC
|
262
269
|
# sample_rate_hertz = 44100
|
263
270
|
# language_code = "en-US"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-speech
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.30.
|
4
|
+
version: 0.30.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-gax
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.3'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '5.10'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: redcarpet
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rubocop
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,7 +80,21 @@ dependencies:
|
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0.9'
|
69
|
-
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: yard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.9'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.9'
|
97
|
+
description: google-cloud-speech is the official library for Google Cloud Speech API.
|
70
98
|
email: googleapis-packages@google.com
|
71
99
|
executables: []
|
72
100
|
extensions: []
|
@@ -129,5 +157,5 @@ rubyforge_project:
|
|
129
157
|
rubygems_version: 2.7.7
|
130
158
|
signing_key:
|
131
159
|
specification_version: 4
|
132
|
-
summary: API Client library for Cloud Speech API
|
160
|
+
summary: API Client library for Google Cloud Speech API
|
133
161
|
test_files: []
|