google-cloud-language-v2 0.a → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,501 @@
|
|
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
|
+
|
20
|
+
module Google
|
21
|
+
module Cloud
|
22
|
+
module Language
|
23
|
+
module V2
|
24
|
+
# Represents the input to API methods.
|
25
|
+
# @!attribute [rw] type
|
26
|
+
# @return [::Google::Cloud::Language::V2::Document::Type]
|
27
|
+
# Required. If the type is not set or is `TYPE_UNSPECIFIED`,
|
28
|
+
# returns an `INVALID_ARGUMENT` error.
|
29
|
+
# @!attribute [rw] content
|
30
|
+
# @return [::String]
|
31
|
+
# The content of the input in string format.
|
32
|
+
# Cloud audit logging exempt since it is based on user data.
|
33
|
+
# @!attribute [rw] gcs_content_uri
|
34
|
+
# @return [::String]
|
35
|
+
# The Google Cloud Storage URI where the file content is located.
|
36
|
+
# This URI must be of the form: gs://bucket_name/object_name. For more
|
37
|
+
# details, see https://cloud.google.com/storage/docs/reference-uris.
|
38
|
+
# NOTE: Cloud Storage object versioning is not supported.
|
39
|
+
# @!attribute [rw] language_code
|
40
|
+
# @return [::String]
|
41
|
+
# Optional. The language of the document (if not specified, the language is
|
42
|
+
# automatically detected). Both ISO and BCP-47 language codes are
|
43
|
+
# accepted.<br>
|
44
|
+
# [Language
|
45
|
+
# Support](https://cloud.google.com/natural-language/docs/languages) lists
|
46
|
+
# currently supported languages for each API method. If the language (either
|
47
|
+
# specified by the caller or automatically detected) is not supported by the
|
48
|
+
# called API method, an `INVALID_ARGUMENT` error is returned.
|
49
|
+
class Document
|
50
|
+
include ::Google::Protobuf::MessageExts
|
51
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
52
|
+
|
53
|
+
# The document types enum.
|
54
|
+
module Type
|
55
|
+
# The content type is not specified.
|
56
|
+
TYPE_UNSPECIFIED = 0
|
57
|
+
|
58
|
+
# Plain text
|
59
|
+
PLAIN_TEXT = 1
|
60
|
+
|
61
|
+
# HTML
|
62
|
+
HTML = 2
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# Represents a sentence in the input document.
|
67
|
+
# @!attribute [rw] text
|
68
|
+
# @return [::Google::Cloud::Language::V2::TextSpan]
|
69
|
+
# The sentence text.
|
70
|
+
# @!attribute [rw] sentiment
|
71
|
+
# @return [::Google::Cloud::Language::V2::Sentiment]
|
72
|
+
# For calls to [AnalyzeSentiment][] or if
|
73
|
+
# {::Google::Cloud::Language::V2::AnnotateTextRequest::Features#extract_document_sentiment AnnotateTextRequest.Features.extract_document_sentiment}
|
74
|
+
# is set to true, this field will contain the sentiment for the sentence.
|
75
|
+
class Sentence
|
76
|
+
include ::Google::Protobuf::MessageExts
|
77
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
78
|
+
end
|
79
|
+
|
80
|
+
# Represents a phrase in the text that is a known entity, such as
|
81
|
+
# a person, an organization, or location. The API associates information, such
|
82
|
+
# as probability and mentions, with entities.
|
83
|
+
# @!attribute [rw] name
|
84
|
+
# @return [::String]
|
85
|
+
# The representative name for the entity.
|
86
|
+
# @!attribute [rw] type
|
87
|
+
# @return [::Google::Cloud::Language::V2::Entity::Type]
|
88
|
+
# The entity type.
|
89
|
+
# @!attribute [rw] metadata
|
90
|
+
# @return [::Google::Protobuf::Map{::String => ::String}]
|
91
|
+
# Metadata associated with the entity.
|
92
|
+
#
|
93
|
+
# For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`)
|
94
|
+
# and Knowledge Graph MID (`mid`), if they are available. For the metadata
|
95
|
+
# associated with other entity types, see the Type table below.
|
96
|
+
# @!attribute [rw] mentions
|
97
|
+
# @return [::Array<::Google::Cloud::Language::V2::EntityMention>]
|
98
|
+
# The mentions of this entity in the input document. The API currently
|
99
|
+
# supports proper noun mentions.
|
100
|
+
# @!attribute [rw] sentiment
|
101
|
+
# @return [::Google::Cloud::Language::V2::Sentiment]
|
102
|
+
# For calls to [AnalyzeEntitySentiment][] or if
|
103
|
+
# [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v2.AnnotateTextRequest.Features.extract_entity_sentiment]
|
104
|
+
# is set to true, this field will contain the aggregate sentiment expressed
|
105
|
+
# for this entity in the provided document.
|
106
|
+
class Entity
|
107
|
+
include ::Google::Protobuf::MessageExts
|
108
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
109
|
+
|
110
|
+
# @!attribute [rw] key
|
111
|
+
# @return [::String]
|
112
|
+
# @!attribute [rw] value
|
113
|
+
# @return [::String]
|
114
|
+
class MetadataEntry
|
115
|
+
include ::Google::Protobuf::MessageExts
|
116
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
117
|
+
end
|
118
|
+
|
119
|
+
# The type of the entity. For most entity types, the associated metadata is a
|
120
|
+
# Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`). The table
|
121
|
+
# below lists the associated fields for entities that have different
|
122
|
+
# metadata.
|
123
|
+
module Type
|
124
|
+
# Unknown
|
125
|
+
UNKNOWN = 0
|
126
|
+
|
127
|
+
# Person
|
128
|
+
PERSON = 1
|
129
|
+
|
130
|
+
# Location
|
131
|
+
LOCATION = 2
|
132
|
+
|
133
|
+
# Organization
|
134
|
+
ORGANIZATION = 3
|
135
|
+
|
136
|
+
# Event
|
137
|
+
EVENT = 4
|
138
|
+
|
139
|
+
# Artwork
|
140
|
+
WORK_OF_ART = 5
|
141
|
+
|
142
|
+
# Consumer product
|
143
|
+
CONSUMER_GOOD = 6
|
144
|
+
|
145
|
+
# Other types of entities
|
146
|
+
OTHER = 7
|
147
|
+
|
148
|
+
# Phone number
|
149
|
+
#
|
150
|
+
# The metadata lists the phone number, formatted according to local
|
151
|
+
# convention, plus whichever additional elements appear in the text:
|
152
|
+
#
|
153
|
+
# * `number` - the actual number, broken down into sections as per local
|
154
|
+
# convention
|
155
|
+
# * `national_prefix` - country code, if detected
|
156
|
+
# * `area_code` - region or area code, if detected
|
157
|
+
# * `extension` - phone extension (to be dialed after connection), if
|
158
|
+
# detected
|
159
|
+
PHONE_NUMBER = 9
|
160
|
+
|
161
|
+
# Address
|
162
|
+
#
|
163
|
+
# The metadata identifies the street number and locality plus whichever
|
164
|
+
# additional elements appear in the text:
|
165
|
+
#
|
166
|
+
# * `street_number` - street number
|
167
|
+
# * `locality` - city or town
|
168
|
+
# * `street_name` - street/route name, if detected
|
169
|
+
# * `postal_code` - postal code, if detected
|
170
|
+
# * `country` - country, if detected<
|
171
|
+
# * `broad_region` - administrative area, such as the state, if detected
|
172
|
+
# * `narrow_region` - smaller administrative area, such as county, if
|
173
|
+
# detected
|
174
|
+
# * `sublocality` - used in Asian addresses to demark a district within a
|
175
|
+
# city, if detected
|
176
|
+
ADDRESS = 10
|
177
|
+
|
178
|
+
# Date
|
179
|
+
#
|
180
|
+
# The metadata identifies the components of the date:
|
181
|
+
#
|
182
|
+
# * `year` - four digit year, if detected
|
183
|
+
# * `month` - two digit month number, if detected
|
184
|
+
# * `day` - two digit day number, if detected
|
185
|
+
DATE = 11
|
186
|
+
|
187
|
+
# Number
|
188
|
+
#
|
189
|
+
# The metadata is the number itself.
|
190
|
+
NUMBER = 12
|
191
|
+
|
192
|
+
# Price
|
193
|
+
#
|
194
|
+
# The metadata identifies the `value` and `currency`.
|
195
|
+
PRICE = 13
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
# Represents the feeling associated with the entire text or entities in
|
200
|
+
# the text.
|
201
|
+
# @!attribute [rw] magnitude
|
202
|
+
# @return [::Float]
|
203
|
+
# A non-negative number in the [0, +inf) range, which represents
|
204
|
+
# the absolute magnitude of sentiment regardless of score (positive or
|
205
|
+
# negative).
|
206
|
+
# @!attribute [rw] score
|
207
|
+
# @return [::Float]
|
208
|
+
# Sentiment score between -1.0 (negative sentiment) and 1.0
|
209
|
+
# (positive sentiment).
|
210
|
+
class Sentiment
|
211
|
+
include ::Google::Protobuf::MessageExts
|
212
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
213
|
+
end
|
214
|
+
|
215
|
+
# Represents a mention for an entity in the text. Currently, proper noun
|
216
|
+
# mentions are supported.
|
217
|
+
# @!attribute [rw] text
|
218
|
+
# @return [::Google::Cloud::Language::V2::TextSpan]
|
219
|
+
# The mention text.
|
220
|
+
# @!attribute [rw] type
|
221
|
+
# @return [::Google::Cloud::Language::V2::EntityMention::Type]
|
222
|
+
# The type of the entity mention.
|
223
|
+
# @!attribute [rw] sentiment
|
224
|
+
# @return [::Google::Cloud::Language::V2::Sentiment]
|
225
|
+
# For calls to [AnalyzeEntitySentiment][] or if
|
226
|
+
# [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v2.AnnotateTextRequest.Features.extract_entity_sentiment]
|
227
|
+
# is set to true, this field will contain the sentiment expressed for this
|
228
|
+
# mention of the entity in the provided document.
|
229
|
+
# @!attribute [rw] probability
|
230
|
+
# @return [::Float]
|
231
|
+
# Probability score associated with the entity.
|
232
|
+
#
|
233
|
+
# The score shows the probability of the entity mention being the entity
|
234
|
+
# type. The score is in (0, 1] range.
|
235
|
+
class EntityMention
|
236
|
+
include ::Google::Protobuf::MessageExts
|
237
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
238
|
+
|
239
|
+
# The supported types of mentions.
|
240
|
+
module Type
|
241
|
+
# Unknown
|
242
|
+
TYPE_UNKNOWN = 0
|
243
|
+
|
244
|
+
# Proper name
|
245
|
+
PROPER = 1
|
246
|
+
|
247
|
+
# Common noun (or noun compound)
|
248
|
+
COMMON = 2
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
# Represents a text span in the input document.
|
253
|
+
# @!attribute [rw] content
|
254
|
+
# @return [::String]
|
255
|
+
# The content of the text span, which is a substring of the document.
|
256
|
+
# @!attribute [rw] begin_offset
|
257
|
+
# @return [::Integer]
|
258
|
+
# The API calculates the beginning offset of the content in the original
|
259
|
+
# document according to the
|
260
|
+
# {::Google::Cloud::Language::V2::EncodingType EncodingType} specified in the API
|
261
|
+
# request.
|
262
|
+
class TextSpan
|
263
|
+
include ::Google::Protobuf::MessageExts
|
264
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
265
|
+
end
|
266
|
+
|
267
|
+
# Represents a category returned from the text classifier.
|
268
|
+
# @!attribute [rw] name
|
269
|
+
# @return [::String]
|
270
|
+
# The name of the category representing the document.
|
271
|
+
# @!attribute [rw] confidence
|
272
|
+
# @return [::Float]
|
273
|
+
# The classifier's confidence of the category. Number represents how certain
|
274
|
+
# the classifier is that this category represents the given text.
|
275
|
+
class ClassificationCategory
|
276
|
+
include ::Google::Protobuf::MessageExts
|
277
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
278
|
+
end
|
279
|
+
|
280
|
+
# The sentiment analysis request message.
|
281
|
+
# @!attribute [rw] document
|
282
|
+
# @return [::Google::Cloud::Language::V2::Document]
|
283
|
+
# Required. Input document.
|
284
|
+
# @!attribute [rw] encoding_type
|
285
|
+
# @return [::Google::Cloud::Language::V2::EncodingType]
|
286
|
+
# The encoding type used by the API to calculate sentence offsets.
|
287
|
+
class AnalyzeSentimentRequest
|
288
|
+
include ::Google::Protobuf::MessageExts
|
289
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
290
|
+
end
|
291
|
+
|
292
|
+
# The sentiment analysis response message.
|
293
|
+
# @!attribute [rw] document_sentiment
|
294
|
+
# @return [::Google::Cloud::Language::V2::Sentiment]
|
295
|
+
# The overall sentiment of the input document.
|
296
|
+
# @!attribute [rw] language_code
|
297
|
+
# @return [::String]
|
298
|
+
# The language of the text, which will be the same as the language specified
|
299
|
+
# in the request or, if not specified, the automatically-detected language.
|
300
|
+
# See [Document.language][] field for more details.
|
301
|
+
# @!attribute [rw] sentences
|
302
|
+
# @return [::Array<::Google::Cloud::Language::V2::Sentence>]
|
303
|
+
# The sentiment for all the sentences in the document.
|
304
|
+
# @!attribute [rw] language_supported
|
305
|
+
# @return [::Boolean]
|
306
|
+
# Whether the language is officially supported. The API may still return a
|
307
|
+
# response when the language is not supported, but it is on a best effort
|
308
|
+
# basis.
|
309
|
+
class AnalyzeSentimentResponse
|
310
|
+
include ::Google::Protobuf::MessageExts
|
311
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
312
|
+
end
|
313
|
+
|
314
|
+
# The entity analysis request message.
|
315
|
+
# @!attribute [rw] document
|
316
|
+
# @return [::Google::Cloud::Language::V2::Document]
|
317
|
+
# Required. Input document.
|
318
|
+
# @!attribute [rw] encoding_type
|
319
|
+
# @return [::Google::Cloud::Language::V2::EncodingType]
|
320
|
+
# The encoding type used by the API to calculate offsets.
|
321
|
+
class AnalyzeEntitiesRequest
|
322
|
+
include ::Google::Protobuf::MessageExts
|
323
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
324
|
+
end
|
325
|
+
|
326
|
+
# The entity analysis response message.
|
327
|
+
# @!attribute [rw] entities
|
328
|
+
# @return [::Array<::Google::Cloud::Language::V2::Entity>]
|
329
|
+
# The recognized entities in the input document.
|
330
|
+
# @!attribute [rw] language_code
|
331
|
+
# @return [::String]
|
332
|
+
# The language of the text, which will be the same as the language specified
|
333
|
+
# in the request or, if not specified, the automatically-detected language.
|
334
|
+
# See [Document.language][] field for more details.
|
335
|
+
# @!attribute [rw] language_supported
|
336
|
+
# @return [::Boolean]
|
337
|
+
# Whether the language is officially supported. The API may still return a
|
338
|
+
# response when the language is not supported, but it is on a best effort
|
339
|
+
# basis.
|
340
|
+
class AnalyzeEntitiesResponse
|
341
|
+
include ::Google::Protobuf::MessageExts
|
342
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
343
|
+
end
|
344
|
+
|
345
|
+
# The document classification request message.
|
346
|
+
# @!attribute [rw] document
|
347
|
+
# @return [::Google::Cloud::Language::V2::Document]
|
348
|
+
# Required. Input document.
|
349
|
+
class ClassifyTextRequest
|
350
|
+
include ::Google::Protobuf::MessageExts
|
351
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
352
|
+
end
|
353
|
+
|
354
|
+
# The document classification response message.
|
355
|
+
# @!attribute [rw] categories
|
356
|
+
# @return [::Array<::Google::Cloud::Language::V2::ClassificationCategory>]
|
357
|
+
# Categories representing the input document.
|
358
|
+
# @!attribute [rw] language_code
|
359
|
+
# @return [::String]
|
360
|
+
# The language of the text, which will be the same as the language specified
|
361
|
+
# in the request or, if not specified, the automatically-detected language.
|
362
|
+
# See [Document.language][] field for more details.
|
363
|
+
# @!attribute [rw] language_supported
|
364
|
+
# @return [::Boolean]
|
365
|
+
# Whether the language is officially supported. The API may still return a
|
366
|
+
# response when the language is not supported, but it is on a best effort
|
367
|
+
# basis.
|
368
|
+
class ClassifyTextResponse
|
369
|
+
include ::Google::Protobuf::MessageExts
|
370
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
371
|
+
end
|
372
|
+
|
373
|
+
# The document moderation request message.
|
374
|
+
# @!attribute [rw] document
|
375
|
+
# @return [::Google::Cloud::Language::V2::Document]
|
376
|
+
# Required. Input document.
|
377
|
+
class ModerateTextRequest
|
378
|
+
include ::Google::Protobuf::MessageExts
|
379
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
380
|
+
end
|
381
|
+
|
382
|
+
# The document moderation response message.
|
383
|
+
# @!attribute [rw] moderation_categories
|
384
|
+
# @return [::Array<::Google::Cloud::Language::V2::ClassificationCategory>]
|
385
|
+
# Harmful and sensitive categories representing the input document.
|
386
|
+
# @!attribute [rw] language_code
|
387
|
+
# @return [::String]
|
388
|
+
# The language of the text, which will be the same as the language specified
|
389
|
+
# in the request or, if not specified, the automatically-detected language.
|
390
|
+
# See [Document.language][] field for more details.
|
391
|
+
# @!attribute [rw] language_supported
|
392
|
+
# @return [::Boolean]
|
393
|
+
# Whether the language is officially supported. The API may still return a
|
394
|
+
# response when the language is not supported, but it is on a best effort
|
395
|
+
# basis.
|
396
|
+
class ModerateTextResponse
|
397
|
+
include ::Google::Protobuf::MessageExts
|
398
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
399
|
+
end
|
400
|
+
|
401
|
+
# The request message for the text annotation API, which can perform multiple
|
402
|
+
# analysis types in one call.
|
403
|
+
# @!attribute [rw] document
|
404
|
+
# @return [::Google::Cloud::Language::V2::Document]
|
405
|
+
# Required. Input document.
|
406
|
+
# @!attribute [rw] features
|
407
|
+
# @return [::Google::Cloud::Language::V2::AnnotateTextRequest::Features]
|
408
|
+
# Required. The enabled features.
|
409
|
+
# @!attribute [rw] encoding_type
|
410
|
+
# @return [::Google::Cloud::Language::V2::EncodingType]
|
411
|
+
# The encoding type used by the API to calculate offsets.
|
412
|
+
class AnnotateTextRequest
|
413
|
+
include ::Google::Protobuf::MessageExts
|
414
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
415
|
+
|
416
|
+
# All available features.
|
417
|
+
# Setting each one to true will enable that specific analysis for the input.
|
418
|
+
# @!attribute [rw] extract_entities
|
419
|
+
# @return [::Boolean]
|
420
|
+
# Optional. Extract entities.
|
421
|
+
# @!attribute [rw] extract_document_sentiment
|
422
|
+
# @return [::Boolean]
|
423
|
+
# Optional. Extract document-level sentiment.
|
424
|
+
# @!attribute [rw] classify_text
|
425
|
+
# @return [::Boolean]
|
426
|
+
# Optional. Classify the full document into categories.
|
427
|
+
# @!attribute [rw] moderate_text
|
428
|
+
# @return [::Boolean]
|
429
|
+
# Optional. Moderate the document for harmful and sensitive categories.
|
430
|
+
class Features
|
431
|
+
include ::Google::Protobuf::MessageExts
|
432
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
433
|
+
end
|
434
|
+
end
|
435
|
+
|
436
|
+
# The text annotations response message.
|
437
|
+
# @!attribute [rw] sentences
|
438
|
+
# @return [::Array<::Google::Cloud::Language::V2::Sentence>]
|
439
|
+
# Sentences in the input document. Populated if the user enables
|
440
|
+
# {::Google::Cloud::Language::V2::AnnotateTextRequest::Features#extract_document_sentiment AnnotateTextRequest.Features.extract_document_sentiment}.
|
441
|
+
# @!attribute [rw] entities
|
442
|
+
# @return [::Array<::Google::Cloud::Language::V2::Entity>]
|
443
|
+
# Entities, along with their semantic information, in the input document.
|
444
|
+
# Populated if the user enables
|
445
|
+
# {::Google::Cloud::Language::V2::AnnotateTextRequest::Features#extract_entities AnnotateTextRequest.Features.extract_entities}
|
446
|
+
# or
|
447
|
+
# [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v2.AnnotateTextRequest.Features.extract_entity_sentiment].
|
448
|
+
# @!attribute [rw] document_sentiment
|
449
|
+
# @return [::Google::Cloud::Language::V2::Sentiment]
|
450
|
+
# The overall sentiment for the document. Populated if the user enables
|
451
|
+
# {::Google::Cloud::Language::V2::AnnotateTextRequest::Features#extract_document_sentiment AnnotateTextRequest.Features.extract_document_sentiment}.
|
452
|
+
# @!attribute [rw] language_code
|
453
|
+
# @return [::String]
|
454
|
+
# The language of the text, which will be the same as the language specified
|
455
|
+
# in the request or, if not specified, the automatically-detected language.
|
456
|
+
# See [Document.language][] field for more details.
|
457
|
+
# @!attribute [rw] categories
|
458
|
+
# @return [::Array<::Google::Cloud::Language::V2::ClassificationCategory>]
|
459
|
+
# Categories identified in the input document.
|
460
|
+
# @!attribute [rw] moderation_categories
|
461
|
+
# @return [::Array<::Google::Cloud::Language::V2::ClassificationCategory>]
|
462
|
+
# Harmful and sensitive categories identified in the input document.
|
463
|
+
# @!attribute [rw] language_supported
|
464
|
+
# @return [::Boolean]
|
465
|
+
# Whether the language is officially supported by all requested features.
|
466
|
+
# The API may still return a response when the language is not supported, but
|
467
|
+
# it is on a best effort basis.
|
468
|
+
class AnnotateTextResponse
|
469
|
+
include ::Google::Protobuf::MessageExts
|
470
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
471
|
+
end
|
472
|
+
|
473
|
+
# Represents the text encoding that the caller uses to process the output.
|
474
|
+
# Providing an `EncodingType` is recommended because the API provides the
|
475
|
+
# beginning offsets for various outputs, such as tokens and mentions, and
|
476
|
+
# languages that natively use different text encodings may access offsets
|
477
|
+
# differently.
|
478
|
+
module EncodingType
|
479
|
+
# If `EncodingType` is not specified, encoding-dependent information (such as
|
480
|
+
# `begin_offset`) will be set at `-1`.
|
481
|
+
NONE = 0
|
482
|
+
|
483
|
+
# Encoding-dependent information (such as `begin_offset`) is calculated based
|
484
|
+
# on the UTF-8 encoding of the input. C++ and Go are examples of languages
|
485
|
+
# that use this encoding natively.
|
486
|
+
UTF8 = 1
|
487
|
+
|
488
|
+
# Encoding-dependent information (such as `begin_offset`) is calculated based
|
489
|
+
# on the UTF-16 encoding of the input. Java and JavaScript are examples of
|
490
|
+
# languages that use this encoding natively.
|
491
|
+
UTF16 = 2
|
492
|
+
|
493
|
+
# Encoding-dependent information (such as `begin_offset`) is calculated based
|
494
|
+
# on the UTF-32 encoding of the input. Python is an example of a language
|
495
|
+
# that uses this encoding natively.
|
496
|
+
UTF32 = 3
|
497
|
+
end
|
498
|
+
end
|
499
|
+
end
|
500
|
+
end
|
501
|
+
end
|
@@ -0,0 +1,98 @@
|
|
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
|
+
|
20
|
+
module Google
|
21
|
+
module Protobuf
|
22
|
+
# A Duration represents a signed, fixed-length span of time represented
|
23
|
+
# as a count of seconds and fractions of seconds at nanosecond
|
24
|
+
# resolution. It is independent of any calendar and concepts like "day"
|
25
|
+
# or "month". It is related to Timestamp in that the difference between
|
26
|
+
# two Timestamp values is a Duration and it can be added or subtracted
|
27
|
+
# from a Timestamp. Range is approximately +-10,000 years.
|
28
|
+
#
|
29
|
+
# # Examples
|
30
|
+
#
|
31
|
+
# Example 1: Compute Duration from two Timestamps in pseudo code.
|
32
|
+
#
|
33
|
+
# Timestamp start = ...;
|
34
|
+
# Timestamp end = ...;
|
35
|
+
# Duration duration = ...;
|
36
|
+
#
|
37
|
+
# duration.seconds = end.seconds - start.seconds;
|
38
|
+
# duration.nanos = end.nanos - start.nanos;
|
39
|
+
#
|
40
|
+
# if (duration.seconds < 0 && duration.nanos > 0) {
|
41
|
+
# duration.seconds += 1;
|
42
|
+
# duration.nanos -= 1000000000;
|
43
|
+
# } else if (duration.seconds > 0 && duration.nanos < 0) {
|
44
|
+
# duration.seconds -= 1;
|
45
|
+
# duration.nanos += 1000000000;
|
46
|
+
# }
|
47
|
+
#
|
48
|
+
# Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
|
49
|
+
#
|
50
|
+
# Timestamp start = ...;
|
51
|
+
# Duration duration = ...;
|
52
|
+
# Timestamp end = ...;
|
53
|
+
#
|
54
|
+
# end.seconds = start.seconds + duration.seconds;
|
55
|
+
# end.nanos = start.nanos + duration.nanos;
|
56
|
+
#
|
57
|
+
# if (end.nanos < 0) {
|
58
|
+
# end.seconds -= 1;
|
59
|
+
# end.nanos += 1000000000;
|
60
|
+
# } else if (end.nanos >= 1000000000) {
|
61
|
+
# end.seconds += 1;
|
62
|
+
# end.nanos -= 1000000000;
|
63
|
+
# }
|
64
|
+
#
|
65
|
+
# Example 3: Compute Duration from datetime.timedelta in Python.
|
66
|
+
#
|
67
|
+
# td = datetime.timedelta(days=3, minutes=10)
|
68
|
+
# duration = Duration()
|
69
|
+
# duration.FromTimedelta(td)
|
70
|
+
#
|
71
|
+
# # JSON Mapping
|
72
|
+
#
|
73
|
+
# In JSON format, the Duration type is encoded as a string rather than an
|
74
|
+
# object, where the string ends in the suffix "s" (indicating seconds) and
|
75
|
+
# is preceded by the number of seconds, with nanoseconds expressed as
|
76
|
+
# fractional seconds. For example, 3 seconds with 0 nanoseconds should be
|
77
|
+
# encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
|
78
|
+
# be expressed in JSON format as "3.000000001s", and 3 seconds and 1
|
79
|
+
# microsecond should be expressed in JSON format as "3.000001s".
|
80
|
+
# @!attribute [rw] seconds
|
81
|
+
# @return [::Integer]
|
82
|
+
# Signed seconds of the span of time. Must be from -315,576,000,000
|
83
|
+
# to +315,576,000,000 inclusive. Note: these bounds are computed from:
|
84
|
+
# 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
|
85
|
+
# @!attribute [rw] nanos
|
86
|
+
# @return [::Integer]
|
87
|
+
# Signed fractions of a second at nanosecond resolution of the span
|
88
|
+
# of time. Durations less than one second are represented with a 0
|
89
|
+
# `seconds` field and a positive or negative `nanos` field. For durations
|
90
|
+
# of one second or more, a non-zero value for the `nanos` field must be
|
91
|
+
# of the same sign as the `seconds` field. Must be from -999,999,999
|
92
|
+
# to +999,999,999 inclusive.
|
93
|
+
class Duration
|
94
|
+
include ::Google::Protobuf::MessageExts
|
95
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|