google-cloud-language-v2 0.a → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +149 -0
- data/README.md +144 -8
- data/lib/google/cloud/language/v2/language_service/client.rb +751 -0
- data/lib/google/cloud/language/v2/language_service/credentials.rb +48 -0
- data/lib/google/cloud/language/v2/language_service/rest/client.rb +656 -0
- data/lib/google/cloud/language/v2/language_service/rest/service_stub.rb +338 -0
- data/lib/google/cloud/language/v2/language_service/rest.rb +52 -0
- data/lib/google/cloud/language/v2/language_service.rb +55 -0
- data/lib/google/cloud/language/v2/language_service_pb.rb +67 -0
- data/lib/google/cloud/language/v2/language_service_services_pb.rb +56 -0
- data/lib/google/cloud/language/v2/rest.rb +37 -0
- data/lib/google/cloud/language/v2/version.rb +7 -2
- data/lib/google/cloud/language/v2.rb +45 -0
- data/lib/google-cloud-language-v2.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/client.rb +381 -0
- data/proto_docs/google/api/field_behavior.rb +85 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/api/resource.rb +222 -0
- data/proto_docs/google/cloud/language/v2/language_service.rb +501 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- metadata +180 -13
@@ -0,0 +1,338 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/language/v2/language_service_pb"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module Language
|
24
|
+
module V2
|
25
|
+
module LanguageService
|
26
|
+
module Rest
|
27
|
+
##
|
28
|
+
# REST service stub for the LanguageService service.
|
29
|
+
# Service stub contains baseline method implementations
|
30
|
+
# including transcoding, making the REST call, and deserialing the response.
|
31
|
+
#
|
32
|
+
class ServiceStub
|
33
|
+
def initialize endpoint:, credentials:
|
34
|
+
# These require statements are intentionally placed here to initialize
|
35
|
+
# the REST modules only when it's required.
|
36
|
+
require "gapic/rest"
|
37
|
+
|
38
|
+
@client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials,
|
39
|
+
numeric_enums: true,
|
40
|
+
raise_faraday_errors: false
|
41
|
+
end
|
42
|
+
|
43
|
+
##
|
44
|
+
# Baseline implementation for the analyze_sentiment REST call
|
45
|
+
#
|
46
|
+
# @param request_pb [::Google::Cloud::Language::V2::AnalyzeSentimentRequest]
|
47
|
+
# A request object representing the call parameters. Required.
|
48
|
+
# @param options [::Gapic::CallOptions]
|
49
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
50
|
+
#
|
51
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
52
|
+
# @yieldparam result [::Google::Cloud::Language::V2::AnalyzeSentimentResponse]
|
53
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
54
|
+
#
|
55
|
+
# @return [::Google::Cloud::Language::V2::AnalyzeSentimentResponse]
|
56
|
+
# A result object deserialized from the server's reply
|
57
|
+
def analyze_sentiment request_pb, options = nil
|
58
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
59
|
+
|
60
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_analyze_sentiment_request request_pb
|
61
|
+
query_string_params = if query_string_params.any?
|
62
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
63
|
+
else
|
64
|
+
{}
|
65
|
+
end
|
66
|
+
|
67
|
+
response = @client_stub.make_http_request(
|
68
|
+
verb,
|
69
|
+
uri: uri,
|
70
|
+
body: body || "",
|
71
|
+
params: query_string_params,
|
72
|
+
options: options
|
73
|
+
)
|
74
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
75
|
+
result = ::Google::Cloud::Language::V2::AnalyzeSentimentResponse.decode_json response.body, ignore_unknown_fields: true
|
76
|
+
|
77
|
+
yield result, operation if block_given?
|
78
|
+
result
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# Baseline implementation for the analyze_entities REST call
|
83
|
+
#
|
84
|
+
# @param request_pb [::Google::Cloud::Language::V2::AnalyzeEntitiesRequest]
|
85
|
+
# A request object representing the call parameters. Required.
|
86
|
+
# @param options [::Gapic::CallOptions]
|
87
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
88
|
+
#
|
89
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
90
|
+
# @yieldparam result [::Google::Cloud::Language::V2::AnalyzeEntitiesResponse]
|
91
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
92
|
+
#
|
93
|
+
# @return [::Google::Cloud::Language::V2::AnalyzeEntitiesResponse]
|
94
|
+
# A result object deserialized from the server's reply
|
95
|
+
def analyze_entities request_pb, options = nil
|
96
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
97
|
+
|
98
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_analyze_entities_request request_pb
|
99
|
+
query_string_params = if query_string_params.any?
|
100
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
101
|
+
else
|
102
|
+
{}
|
103
|
+
end
|
104
|
+
|
105
|
+
response = @client_stub.make_http_request(
|
106
|
+
verb,
|
107
|
+
uri: uri,
|
108
|
+
body: body || "",
|
109
|
+
params: query_string_params,
|
110
|
+
options: options
|
111
|
+
)
|
112
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
113
|
+
result = ::Google::Cloud::Language::V2::AnalyzeEntitiesResponse.decode_json response.body, ignore_unknown_fields: true
|
114
|
+
|
115
|
+
yield result, operation if block_given?
|
116
|
+
result
|
117
|
+
end
|
118
|
+
|
119
|
+
##
|
120
|
+
# Baseline implementation for the classify_text REST call
|
121
|
+
#
|
122
|
+
# @param request_pb [::Google::Cloud::Language::V2::ClassifyTextRequest]
|
123
|
+
# A request object representing the call parameters. Required.
|
124
|
+
# @param options [::Gapic::CallOptions]
|
125
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
126
|
+
#
|
127
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
128
|
+
# @yieldparam result [::Google::Cloud::Language::V2::ClassifyTextResponse]
|
129
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
130
|
+
#
|
131
|
+
# @return [::Google::Cloud::Language::V2::ClassifyTextResponse]
|
132
|
+
# A result object deserialized from the server's reply
|
133
|
+
def classify_text request_pb, options = nil
|
134
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
135
|
+
|
136
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_classify_text_request request_pb
|
137
|
+
query_string_params = if query_string_params.any?
|
138
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
139
|
+
else
|
140
|
+
{}
|
141
|
+
end
|
142
|
+
|
143
|
+
response = @client_stub.make_http_request(
|
144
|
+
verb,
|
145
|
+
uri: uri,
|
146
|
+
body: body || "",
|
147
|
+
params: query_string_params,
|
148
|
+
options: options
|
149
|
+
)
|
150
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
151
|
+
result = ::Google::Cloud::Language::V2::ClassifyTextResponse.decode_json response.body, ignore_unknown_fields: true
|
152
|
+
|
153
|
+
yield result, operation if block_given?
|
154
|
+
result
|
155
|
+
end
|
156
|
+
|
157
|
+
##
|
158
|
+
# Baseline implementation for the moderate_text REST call
|
159
|
+
#
|
160
|
+
# @param request_pb [::Google::Cloud::Language::V2::ModerateTextRequest]
|
161
|
+
# A request object representing the call parameters. Required.
|
162
|
+
# @param options [::Gapic::CallOptions]
|
163
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
164
|
+
#
|
165
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
166
|
+
# @yieldparam result [::Google::Cloud::Language::V2::ModerateTextResponse]
|
167
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
168
|
+
#
|
169
|
+
# @return [::Google::Cloud::Language::V2::ModerateTextResponse]
|
170
|
+
# A result object deserialized from the server's reply
|
171
|
+
def moderate_text request_pb, options = nil
|
172
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
173
|
+
|
174
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_moderate_text_request request_pb
|
175
|
+
query_string_params = if query_string_params.any?
|
176
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
177
|
+
else
|
178
|
+
{}
|
179
|
+
end
|
180
|
+
|
181
|
+
response = @client_stub.make_http_request(
|
182
|
+
verb,
|
183
|
+
uri: uri,
|
184
|
+
body: body || "",
|
185
|
+
params: query_string_params,
|
186
|
+
options: options
|
187
|
+
)
|
188
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
189
|
+
result = ::Google::Cloud::Language::V2::ModerateTextResponse.decode_json response.body, ignore_unknown_fields: true
|
190
|
+
|
191
|
+
yield result, operation if block_given?
|
192
|
+
result
|
193
|
+
end
|
194
|
+
|
195
|
+
##
|
196
|
+
# Baseline implementation for the annotate_text REST call
|
197
|
+
#
|
198
|
+
# @param request_pb [::Google::Cloud::Language::V2::AnnotateTextRequest]
|
199
|
+
# A request object representing the call parameters. Required.
|
200
|
+
# @param options [::Gapic::CallOptions]
|
201
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
202
|
+
#
|
203
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
204
|
+
# @yieldparam result [::Google::Cloud::Language::V2::AnnotateTextResponse]
|
205
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
206
|
+
#
|
207
|
+
# @return [::Google::Cloud::Language::V2::AnnotateTextResponse]
|
208
|
+
# A result object deserialized from the server's reply
|
209
|
+
def annotate_text request_pb, options = nil
|
210
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
211
|
+
|
212
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_annotate_text_request request_pb
|
213
|
+
query_string_params = if query_string_params.any?
|
214
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
215
|
+
else
|
216
|
+
{}
|
217
|
+
end
|
218
|
+
|
219
|
+
response = @client_stub.make_http_request(
|
220
|
+
verb,
|
221
|
+
uri: uri,
|
222
|
+
body: body || "",
|
223
|
+
params: query_string_params,
|
224
|
+
options: options
|
225
|
+
)
|
226
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
227
|
+
result = ::Google::Cloud::Language::V2::AnnotateTextResponse.decode_json response.body, ignore_unknown_fields: true
|
228
|
+
|
229
|
+
yield result, operation if block_given?
|
230
|
+
result
|
231
|
+
end
|
232
|
+
|
233
|
+
##
|
234
|
+
# @private
|
235
|
+
#
|
236
|
+
# GRPC transcoding helper method for the analyze_sentiment REST call
|
237
|
+
#
|
238
|
+
# @param request_pb [::Google::Cloud::Language::V2::AnalyzeSentimentRequest]
|
239
|
+
# A request object representing the call parameters. Required.
|
240
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
241
|
+
# Uri, Body, Query string parameters
|
242
|
+
def self.transcode_analyze_sentiment_request request_pb
|
243
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
244
|
+
.with_bindings(
|
245
|
+
uri_method: :post,
|
246
|
+
uri_template: "/v2/documents:analyzeSentiment",
|
247
|
+
body: "*",
|
248
|
+
matches: []
|
249
|
+
)
|
250
|
+
transcoder.transcode request_pb
|
251
|
+
end
|
252
|
+
|
253
|
+
##
|
254
|
+
# @private
|
255
|
+
#
|
256
|
+
# GRPC transcoding helper method for the analyze_entities REST call
|
257
|
+
#
|
258
|
+
# @param request_pb [::Google::Cloud::Language::V2::AnalyzeEntitiesRequest]
|
259
|
+
# A request object representing the call parameters. Required.
|
260
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
261
|
+
# Uri, Body, Query string parameters
|
262
|
+
def self.transcode_analyze_entities_request request_pb
|
263
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
264
|
+
.with_bindings(
|
265
|
+
uri_method: :post,
|
266
|
+
uri_template: "/v2/documents:analyzeEntities",
|
267
|
+
body: "*",
|
268
|
+
matches: []
|
269
|
+
)
|
270
|
+
transcoder.transcode request_pb
|
271
|
+
end
|
272
|
+
|
273
|
+
##
|
274
|
+
# @private
|
275
|
+
#
|
276
|
+
# GRPC transcoding helper method for the classify_text REST call
|
277
|
+
#
|
278
|
+
# @param request_pb [::Google::Cloud::Language::V2::ClassifyTextRequest]
|
279
|
+
# A request object representing the call parameters. Required.
|
280
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
281
|
+
# Uri, Body, Query string parameters
|
282
|
+
def self.transcode_classify_text_request request_pb
|
283
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
284
|
+
.with_bindings(
|
285
|
+
uri_method: :post,
|
286
|
+
uri_template: "/v2/documents:classifyText",
|
287
|
+
body: "*",
|
288
|
+
matches: []
|
289
|
+
)
|
290
|
+
transcoder.transcode request_pb
|
291
|
+
end
|
292
|
+
|
293
|
+
##
|
294
|
+
# @private
|
295
|
+
#
|
296
|
+
# GRPC transcoding helper method for the moderate_text REST call
|
297
|
+
#
|
298
|
+
# @param request_pb [::Google::Cloud::Language::V2::ModerateTextRequest]
|
299
|
+
# A request object representing the call parameters. Required.
|
300
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
301
|
+
# Uri, Body, Query string parameters
|
302
|
+
def self.transcode_moderate_text_request request_pb
|
303
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
304
|
+
.with_bindings(
|
305
|
+
uri_method: :post,
|
306
|
+
uri_template: "/v2/documents:moderateText",
|
307
|
+
body: "*",
|
308
|
+
matches: []
|
309
|
+
)
|
310
|
+
transcoder.transcode request_pb
|
311
|
+
end
|
312
|
+
|
313
|
+
##
|
314
|
+
# @private
|
315
|
+
#
|
316
|
+
# GRPC transcoding helper method for the annotate_text REST call
|
317
|
+
#
|
318
|
+
# @param request_pb [::Google::Cloud::Language::V2::AnnotateTextRequest]
|
319
|
+
# A request object representing the call parameters. Required.
|
320
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
321
|
+
# Uri, Body, Query string parameters
|
322
|
+
def self.transcode_annotate_text_request request_pb
|
323
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
324
|
+
.with_bindings(
|
325
|
+
uri_method: :post,
|
326
|
+
uri_template: "/v2/documents:annotateText",
|
327
|
+
body: "*",
|
328
|
+
matches: []
|
329
|
+
)
|
330
|
+
transcoder.transcode request_pb
|
331
|
+
end
|
332
|
+
end
|
333
|
+
end
|
334
|
+
end
|
335
|
+
end
|
336
|
+
end
|
337
|
+
end
|
338
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "gapic/rest"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/language/v2/version"
|
24
|
+
|
25
|
+
require "google/cloud/language/v2/language_service/credentials"
|
26
|
+
require "google/cloud/language/v2/language_service/rest/client"
|
27
|
+
|
28
|
+
module Google
|
29
|
+
module Cloud
|
30
|
+
module Language
|
31
|
+
module V2
|
32
|
+
##
|
33
|
+
# Provides text analysis operations such as sentiment analysis and entity
|
34
|
+
# recognition.
|
35
|
+
#
|
36
|
+
# To load this service and instantiate a REST client:
|
37
|
+
#
|
38
|
+
# require "google/cloud/language/v2/language_service/rest"
|
39
|
+
# client = ::Google::Cloud::Language::V2::LanguageService::Rest::Client.new
|
40
|
+
#
|
41
|
+
module LanguageService
|
42
|
+
# Client for the REST transport
|
43
|
+
module Rest
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
helper_path = ::File.join __dir__, "rest", "helpers.rb"
|
52
|
+
require "google/cloud/language/v2/language_service/rest/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "gapic/common"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/language/v2/version"
|
24
|
+
|
25
|
+
require "google/cloud/language/v2/language_service/credentials"
|
26
|
+
require "google/cloud/language/v2/language_service/client"
|
27
|
+
require "google/cloud/language/v2/language_service/rest"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Cloud
|
31
|
+
module Language
|
32
|
+
module V2
|
33
|
+
##
|
34
|
+
# Provides text analysis operations such as sentiment analysis and entity
|
35
|
+
# recognition.
|
36
|
+
#
|
37
|
+
# @example Load this service and instantiate a gRPC client
|
38
|
+
#
|
39
|
+
# require "google/cloud/language/v2/language_service"
|
40
|
+
# client = ::Google::Cloud::Language::V2::LanguageService::Client.new
|
41
|
+
#
|
42
|
+
# @example Load this service and instantiate a REST client
|
43
|
+
#
|
44
|
+
# require "google/cloud/language/v2/language_service/rest"
|
45
|
+
# client = ::Google::Cloud::Language::V2::LanguageService::Rest::Client.new
|
46
|
+
#
|
47
|
+
module LanguageService
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
helper_path = ::File.join __dir__, "language_service", "helpers.rb"
|
55
|
+
require "google/cloud/language/v2/language_service/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
+
# source: google/cloud/language/v2/language_service.proto
|
4
|
+
|
5
|
+
require 'google/protobuf'
|
6
|
+
|
7
|
+
require 'google/api/annotations_pb'
|
8
|
+
require 'google/api/client_pb'
|
9
|
+
require 'google/api/field_behavior_pb'
|
10
|
+
|
11
|
+
|
12
|
+
descriptor_data = "\n/google/cloud/language/v2/language_service.proto\x12\x18google.cloud.language.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\"\xcd\x01\n\x08\x44ocument\x12\x35\n\x04type\x18\x01 \x01(\x0e\x32\'.google.cloud.language.v2.Document.Type\x12\x11\n\x07\x63ontent\x18\x02 \x01(\tH\x00\x12\x19\n\x0fgcs_content_uri\x18\x03 \x01(\tH\x00\x12\x1a\n\rlanguage_code\x18\x04 \x01(\tB\x03\xe0\x41\x01\"6\n\x04Type\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x0e\n\nPLAIN_TEXT\x10\x01\x12\x08\n\x04HTML\x10\x02\x42\x08\n\x06source\"t\n\x08Sentence\x12\x30\n\x04text\x18\x01 \x01(\x0b\x32\".google.cloud.language.v2.TextSpan\x12\x36\n\tsentiment\x18\x02 \x01(\x0b\x32#.google.cloud.language.v2.Sentiment\"\xed\x03\n\x06\x45ntity\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x33\n\x04type\x18\x02 \x01(\x0e\x32%.google.cloud.language.v2.Entity.Type\x12@\n\x08metadata\x18\x03 \x03(\x0b\x32..google.cloud.language.v2.Entity.MetadataEntry\x12\x39\n\x08mentions\x18\x05 \x03(\x0b\x32\'.google.cloud.language.v2.EntityMention\x12\x36\n\tsentiment\x18\x06 \x01(\x0b\x32#.google.cloud.language.v2.Sentiment\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xb9\x01\n\x04Type\x12\x0b\n\x07UNKNOWN\x10\x00\x12\n\n\x06PERSON\x10\x01\x12\x0c\n\x08LOCATION\x10\x02\x12\x10\n\x0cORGANIZATION\x10\x03\x12\t\n\x05\x45VENT\x10\x04\x12\x0f\n\x0bWORK_OF_ART\x10\x05\x12\x11\n\rCONSUMER_GOOD\x10\x06\x12\t\n\x05OTHER\x10\x07\x12\x10\n\x0cPHONE_NUMBER\x10\t\x12\x0b\n\x07\x41\x44\x44RESS\x10\n\x12\x08\n\x04\x44\x41TE\x10\x0b\x12\n\n\x06NUMBER\x10\x0c\x12\t\n\x05PRICE\x10\r\"-\n\tSentiment\x12\x11\n\tmagnitude\x18\x01 \x01(\x02\x12\r\n\x05score\x18\x02 \x01(\x02\"\xfc\x01\n\rEntityMention\x12\x30\n\x04text\x18\x01 \x01(\x0b\x32\".google.cloud.language.v2.TextSpan\x12:\n\x04type\x18\x02 \x01(\x0e\x32,.google.cloud.language.v2.EntityMention.Type\x12\x36\n\tsentiment\x18\x03 \x01(\x0b\x32#.google.cloud.language.v2.Sentiment\x12\x13\n\x0bprobability\x18\x04 \x01(\x02\"0\n\x04Type\x12\x10\n\x0cTYPE_UNKNOWN\x10\x00\x12\n\n\x06PROPER\x10\x01\x12\n\n\x06\x43OMMON\x10\x02\"1\n\x08TextSpan\x12\x0f\n\x07\x63ontent\x18\x01 \x01(\t\x12\x14\n\x0c\x62\x65gin_offset\x18\x02 \x01(\x05\":\n\x16\x43lassificationCategory\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\nconfidence\x18\x02 \x01(\x02\"\x93\x01\n\x17\x41nalyzeSentimentRequest\x12\x39\n\x08\x64ocument\x18\x01 \x01(\x0b\x32\".google.cloud.language.v2.DocumentB\x03\xe0\x41\x02\x12=\n\rencoding_type\x18\x02 \x01(\x0e\x32&.google.cloud.language.v2.EncodingType\"\xc5\x01\n\x18\x41nalyzeSentimentResponse\x12?\n\x12\x64ocument_sentiment\x18\x01 \x01(\x0b\x32#.google.cloud.language.v2.Sentiment\x12\x15\n\rlanguage_code\x18\x02 \x01(\t\x12\x35\n\tsentences\x18\x03 \x03(\x0b\x32\".google.cloud.language.v2.Sentence\x12\x1a\n\x12language_supported\x18\x04 \x01(\x08\"\x92\x01\n\x16\x41nalyzeEntitiesRequest\x12\x39\n\x08\x64ocument\x18\x01 \x01(\x0b\x32\".google.cloud.language.v2.DocumentB\x03\xe0\x41\x02\x12=\n\rencoding_type\x18\x02 \x01(\x0e\x32&.google.cloud.language.v2.EncodingType\"\x80\x01\n\x17\x41nalyzeEntitiesResponse\x12\x32\n\x08\x65ntities\x18\x01 \x03(\x0b\x32 .google.cloud.language.v2.Entity\x12\x15\n\rlanguage_code\x18\x02 \x01(\t\x12\x1a\n\x12language_supported\x18\x03 \x01(\x08\"P\n\x13\x43lassifyTextRequest\x12\x39\n\x08\x64ocument\x18\x01 \x01(\x0b\x32\".google.cloud.language.v2.DocumentB\x03\xe0\x41\x02\"\x8f\x01\n\x14\x43lassifyTextResponse\x12\x44\n\ncategories\x18\x01 \x03(\x0b\x32\x30.google.cloud.language.v2.ClassificationCategory\x12\x15\n\rlanguage_code\x18\x02 \x01(\t\x12\x1a\n\x12language_supported\x18\x03 \x01(\x08\"P\n\x13ModerateTextRequest\x12\x39\n\x08\x64ocument\x18\x01 \x01(\x0b\x32\".google.cloud.language.v2.DocumentB\x03\xe0\x41\x02\"\x9a\x01\n\x14ModerateTextResponse\x12O\n\x15moderation_categories\x18\x01 \x03(\x0b\x32\x30.google.cloud.language.v2.ClassificationCategory\x12\x15\n\rlanguage_code\x18\x02 \x01(\t\x12\x1a\n\x12language_supported\x18\x03 \x01(\x08\"\xeb\x02\n\x13\x41nnotateTextRequest\x12\x39\n\x08\x64ocument\x18\x01 \x01(\x0b\x32\".google.cloud.language.v2.DocumentB\x03\xe0\x41\x02\x12M\n\x08\x66\x65\x61tures\x18\x02 \x01(\x0b\x32\x36.google.cloud.language.v2.AnnotateTextRequest.FeaturesB\x03\xe0\x41\x02\x12=\n\rencoding_type\x18\x03 \x01(\x0e\x32&.google.cloud.language.v2.EncodingType\x1a\x8a\x01\n\x08\x46\x65\x61tures\x12\x1d\n\x10\x65xtract_entities\x18\x01 \x01(\x08\x42\x03\xe0\x41\x01\x12\'\n\x1a\x65xtract_document_sentiment\x18\x02 \x01(\x08\x42\x03\xe0\x41\x01\x12\x1a\n\rclassify_text\x18\x04 \x01(\x08\x42\x03\xe0\x41\x01\x12\x1a\n\rmoderate_text\x18\x05 \x01(\x08\x42\x03\xe0\x41\x01\"\x8c\x03\n\x14\x41nnotateTextResponse\x12\x35\n\tsentences\x18\x01 \x03(\x0b\x32\".google.cloud.language.v2.Sentence\x12\x32\n\x08\x65ntities\x18\x02 \x03(\x0b\x32 .google.cloud.language.v2.Entity\x12?\n\x12\x64ocument_sentiment\x18\x03 \x01(\x0b\x32#.google.cloud.language.v2.Sentiment\x12\x15\n\rlanguage_code\x18\x04 \x01(\t\x12\x44\n\ncategories\x18\x05 \x03(\x0b\x32\x30.google.cloud.language.v2.ClassificationCategory\x12O\n\x15moderation_categories\x18\x06 \x03(\x0b\x32\x30.google.cloud.language.v2.ClassificationCategory\x12\x1a\n\x12language_supported\x18\x07 \x01(\x08*8\n\x0c\x45ncodingType\x12\x08\n\x04NONE\x10\x00\x12\x08\n\x04UTF8\x10\x01\x12\t\n\x05UTF16\x10\x02\x12\t\n\x05UTF32\x10\x03\x32\xb0\x08\n\x0fLanguageService\x12\xc8\x01\n\x10\x41nalyzeSentiment\x12\x31.google.cloud.language.v2.AnalyzeSentimentRequest\x1a\x32.google.cloud.language.v2.AnalyzeSentimentResponse\"M\x82\xd3\xe4\x93\x02#\"\x1e/v2/documents:analyzeSentiment:\x01*\xda\x41\x16\x64ocument,encoding_type\xda\x41\x08\x64ocument\x12\xc4\x01\n\x0f\x41nalyzeEntities\x12\x30.google.cloud.language.v2.AnalyzeEntitiesRequest\x1a\x31.google.cloud.language.v2.AnalyzeEntitiesResponse\"L\x82\xd3\xe4\x93\x02\"\"\x1d/v2/documents:analyzeEntities:\x01*\xda\x41\x16\x64ocument,encoding_type\xda\x41\x08\x64ocument\x12\x9f\x01\n\x0c\x43lassifyText\x12-.google.cloud.language.v2.ClassifyTextRequest\x1a..google.cloud.language.v2.ClassifyTextResponse\"0\x82\xd3\xe4\x93\x02\x1f\"\x1a/v2/documents:classifyText:\x01*\xda\x41\x08\x64ocument\x12\x9f\x01\n\x0cModerateText\x12-.google.cloud.language.v2.ModerateTextRequest\x1a..google.cloud.language.v2.ModerateTextResponse\"0\x82\xd3\xe4\x93\x02\x1f\"\x1a/v2/documents:moderateText:\x01*\xda\x41\x08\x64ocument\x12\xca\x01\n\x0c\x41nnotateText\x12-.google.cloud.language.v2.AnnotateTextRequest\x1a..google.cloud.language.v2.AnnotateTextResponse\"[\x82\xd3\xe4\x93\x02\x1f\"\x1a/v2/documents:annotateText:\x01*\xda\x41\x1f\x64ocument,features,encoding_type\xda\x41\x11\x64ocument,features\x1az\xca\x41\x17language.googleapis.com\xd2\x41]https://www.googleapis.com/auth/cloud-language,https://www.googleapis.com/auth/cloud-platformBp\n\x1c\x63om.google.cloud.language.v2B\x14LanguageServiceProtoP\x01Z8cloud.google.com/go/language/apiv2/languagepb;languagepbb\x06proto3"
|
13
|
+
|
14
|
+
pool = Google::Protobuf::DescriptorPool.generated_pool
|
15
|
+
|
16
|
+
begin
|
17
|
+
pool.add_serialized_file(descriptor_data)
|
18
|
+
rescue TypeError => e
|
19
|
+
# Compatibility code: will be removed in the next major version.
|
20
|
+
require 'google/protobuf/descriptor_pb'
|
21
|
+
parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
|
22
|
+
parsed.clear_dependency
|
23
|
+
serialized = parsed.class.encode(parsed)
|
24
|
+
file = pool.add_serialized_file(serialized)
|
25
|
+
warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
|
26
|
+
imports = [
|
27
|
+
]
|
28
|
+
imports.each do |type_name, expected_filename|
|
29
|
+
import_file = pool.lookup(type_name).file_descriptor
|
30
|
+
if import_file.name != expected_filename
|
31
|
+
warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
warn "Each proto file must use a consistent fully-qualified name."
|
35
|
+
warn "This will become an error in the next major version."
|
36
|
+
end
|
37
|
+
|
38
|
+
module Google
|
39
|
+
module Cloud
|
40
|
+
module Language
|
41
|
+
module V2
|
42
|
+
Document = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.Document").msgclass
|
43
|
+
Document::Type = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.Document.Type").enummodule
|
44
|
+
Sentence = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.Sentence").msgclass
|
45
|
+
Entity = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.Entity").msgclass
|
46
|
+
Entity::Type = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.Entity.Type").enummodule
|
47
|
+
Sentiment = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.Sentiment").msgclass
|
48
|
+
EntityMention = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.EntityMention").msgclass
|
49
|
+
EntityMention::Type = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.EntityMention.Type").enummodule
|
50
|
+
TextSpan = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.TextSpan").msgclass
|
51
|
+
ClassificationCategory = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.ClassificationCategory").msgclass
|
52
|
+
AnalyzeSentimentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.AnalyzeSentimentRequest").msgclass
|
53
|
+
AnalyzeSentimentResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.AnalyzeSentimentResponse").msgclass
|
54
|
+
AnalyzeEntitiesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.AnalyzeEntitiesRequest").msgclass
|
55
|
+
AnalyzeEntitiesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.AnalyzeEntitiesResponse").msgclass
|
56
|
+
ClassifyTextRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.ClassifyTextRequest").msgclass
|
57
|
+
ClassifyTextResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.ClassifyTextResponse").msgclass
|
58
|
+
ModerateTextRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.ModerateTextRequest").msgclass
|
59
|
+
ModerateTextResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.ModerateTextResponse").msgclass
|
60
|
+
AnnotateTextRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.AnnotateTextRequest").msgclass
|
61
|
+
AnnotateTextRequest::Features = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.AnnotateTextRequest.Features").msgclass
|
62
|
+
AnnotateTextResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.AnnotateTextResponse").msgclass
|
63
|
+
EncodingType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.EncodingType").enummodule
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: google/cloud/language/v2/language_service.proto for package 'google.cloud.language.v2'
|
3
|
+
# Original file comments:
|
4
|
+
# Copyright 2023 Google LLC
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'grpc'
|
20
|
+
require 'google/cloud/language/v2/language_service_pb'
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Language
|
25
|
+
module V2
|
26
|
+
module LanguageService
|
27
|
+
# Provides text analysis operations such as sentiment analysis and entity
|
28
|
+
# recognition.
|
29
|
+
class Service
|
30
|
+
|
31
|
+
include ::GRPC::GenericService
|
32
|
+
|
33
|
+
self.marshal_class_method = :encode
|
34
|
+
self.unmarshal_class_method = :decode
|
35
|
+
self.service_name = 'google.cloud.language.v2.LanguageService'
|
36
|
+
|
37
|
+
# Analyzes the sentiment of the provided text.
|
38
|
+
rpc :AnalyzeSentiment, ::Google::Cloud::Language::V2::AnalyzeSentimentRequest, ::Google::Cloud::Language::V2::AnalyzeSentimentResponse
|
39
|
+
# Finds named entities (currently proper names and common nouns) in the text
|
40
|
+
# along with entity types, probability, mentions for each entity, and
|
41
|
+
# other properties.
|
42
|
+
rpc :AnalyzeEntities, ::Google::Cloud::Language::V2::AnalyzeEntitiesRequest, ::Google::Cloud::Language::V2::AnalyzeEntitiesResponse
|
43
|
+
# Classifies a document into categories.
|
44
|
+
rpc :ClassifyText, ::Google::Cloud::Language::V2::ClassifyTextRequest, ::Google::Cloud::Language::V2::ClassifyTextResponse
|
45
|
+
# Moderates a document for harmful and sensitive categories.
|
46
|
+
rpc :ModerateText, ::Google::Cloud::Language::V2::ModerateTextRequest, ::Google::Cloud::Language::V2::ModerateTextResponse
|
47
|
+
# A convenience method that provides all features in one call.
|
48
|
+
rpc :AnnotateText, ::Google::Cloud::Language::V2::AnnotateTextRequest, ::Google::Cloud::Language::V2::AnnotateTextResponse
|
49
|
+
end
|
50
|
+
|
51
|
+
Stub = Service.rpc_stub_class
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/language/v2/language_service/rest"
|
20
|
+
require "google/cloud/language/v2/version"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Language
|
25
|
+
##
|
26
|
+
# To load just the REST part of this package, including all its services, and instantiate a REST client:
|
27
|
+
#
|
28
|
+
# @example
|
29
|
+
#
|
30
|
+
# require "google/cloud/language/v2/rest"
|
31
|
+
# client = ::Google::Cloud::Language::V2::LanguageService::Rest::Client.new
|
32
|
+
#
|
33
|
+
module V2
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright 2023 Google LLC
|
2
4
|
#
|
3
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
6
|
# you may not use this file except in compliance with the License.
|
5
7
|
# You may obtain a copy of the License at
|
6
8
|
#
|
7
|
-
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
10
|
#
|
9
11
|
# Unless required by applicable law or agreed to in writing, software
|
10
12
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -12,11 +14,14 @@
|
|
12
14
|
# See the License for the specific language governing permissions and
|
13
15
|
# limitations under the License.
|
14
16
|
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
|
15
20
|
module Google
|
16
21
|
module Cloud
|
17
22
|
module Language
|
18
23
|
module V2
|
19
|
-
VERSION = "0.
|
24
|
+
VERSION = "0.1.0"
|
20
25
|
end
|
21
26
|
end
|
22
27
|
end
|