google-apis-language_v1beta2 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,28 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Google
16
+ module Apis
17
+ module LanguageV1beta2
18
+ # Version of the google-apis-language_v1beta2 gem
19
+ GEM_VERSION = "0.1.0"
20
+
21
+ # Version of the code generator used to generate this client
22
+ GENERATOR_VERSION = "0.1.1"
23
+
24
+ # Revision of the discovery document this client was generated from
25
+ REVISION = "20200801"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,420 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'date'
16
+ require 'google/apis/core/base_service'
17
+ require 'google/apis/core/json_representation'
18
+ require 'google/apis/core/hashable'
19
+ require 'google/apis/errors'
20
+
21
+ module Google
22
+ module Apis
23
+ module LanguageV1beta2
24
+
25
+ class AnalyzeEntitiesRequest
26
+ class Representation < Google::Apis::Core::JsonRepresentation; end
27
+
28
+ include Google::Apis::Core::JsonObjectSupport
29
+ end
30
+
31
+ class AnalyzeEntitiesResponse
32
+ class Representation < Google::Apis::Core::JsonRepresentation; end
33
+
34
+ include Google::Apis::Core::JsonObjectSupport
35
+ end
36
+
37
+ class AnalyzeEntitySentimentRequest
38
+ class Representation < Google::Apis::Core::JsonRepresentation; end
39
+
40
+ include Google::Apis::Core::JsonObjectSupport
41
+ end
42
+
43
+ class AnalyzeEntitySentimentResponse
44
+ class Representation < Google::Apis::Core::JsonRepresentation; end
45
+
46
+ include Google::Apis::Core::JsonObjectSupport
47
+ end
48
+
49
+ class AnalyzeSentimentRequest
50
+ class Representation < Google::Apis::Core::JsonRepresentation; end
51
+
52
+ include Google::Apis::Core::JsonObjectSupport
53
+ end
54
+
55
+ class AnalyzeSentimentResponse
56
+ class Representation < Google::Apis::Core::JsonRepresentation; end
57
+
58
+ include Google::Apis::Core::JsonObjectSupport
59
+ end
60
+
61
+ class AnalyzeSyntaxRequest
62
+ class Representation < Google::Apis::Core::JsonRepresentation; end
63
+
64
+ include Google::Apis::Core::JsonObjectSupport
65
+ end
66
+
67
+ class AnalyzeSyntaxResponse
68
+ class Representation < Google::Apis::Core::JsonRepresentation; end
69
+
70
+ include Google::Apis::Core::JsonObjectSupport
71
+ end
72
+
73
+ class AnnotateTextRequest
74
+ class Representation < Google::Apis::Core::JsonRepresentation; end
75
+
76
+ include Google::Apis::Core::JsonObjectSupport
77
+ end
78
+
79
+ class AnnotateTextResponse
80
+ class Representation < Google::Apis::Core::JsonRepresentation; end
81
+
82
+ include Google::Apis::Core::JsonObjectSupport
83
+ end
84
+
85
+ class ClassificationCategory
86
+ class Representation < Google::Apis::Core::JsonRepresentation; end
87
+
88
+ include Google::Apis::Core::JsonObjectSupport
89
+ end
90
+
91
+ class ClassifyTextRequest
92
+ class Representation < Google::Apis::Core::JsonRepresentation; end
93
+
94
+ include Google::Apis::Core::JsonObjectSupport
95
+ end
96
+
97
+ class ClassifyTextResponse
98
+ class Representation < Google::Apis::Core::JsonRepresentation; end
99
+
100
+ include Google::Apis::Core::JsonObjectSupport
101
+ end
102
+
103
+ class DependencyEdge
104
+ class Representation < Google::Apis::Core::JsonRepresentation; end
105
+
106
+ include Google::Apis::Core::JsonObjectSupport
107
+ end
108
+
109
+ class Document
110
+ class Representation < Google::Apis::Core::JsonRepresentation; end
111
+
112
+ include Google::Apis::Core::JsonObjectSupport
113
+ end
114
+
115
+ class Entity
116
+ class Representation < Google::Apis::Core::JsonRepresentation; end
117
+
118
+ include Google::Apis::Core::JsonObjectSupport
119
+ end
120
+
121
+ class EntityMention
122
+ class Representation < Google::Apis::Core::JsonRepresentation; end
123
+
124
+ include Google::Apis::Core::JsonObjectSupport
125
+ end
126
+
127
+ class Features
128
+ class Representation < Google::Apis::Core::JsonRepresentation; end
129
+
130
+ include Google::Apis::Core::JsonObjectSupport
131
+ end
132
+
133
+ class PartOfSpeech
134
+ class Representation < Google::Apis::Core::JsonRepresentation; end
135
+
136
+ include Google::Apis::Core::JsonObjectSupport
137
+ end
138
+
139
+ class Sentence
140
+ class Representation < Google::Apis::Core::JsonRepresentation; end
141
+
142
+ include Google::Apis::Core::JsonObjectSupport
143
+ end
144
+
145
+ class Sentiment
146
+ class Representation < Google::Apis::Core::JsonRepresentation; end
147
+
148
+ include Google::Apis::Core::JsonObjectSupport
149
+ end
150
+
151
+ class Status
152
+ class Representation < Google::Apis::Core::JsonRepresentation; end
153
+
154
+ include Google::Apis::Core::JsonObjectSupport
155
+ end
156
+
157
+ class TextSpan
158
+ class Representation < Google::Apis::Core::JsonRepresentation; end
159
+
160
+ include Google::Apis::Core::JsonObjectSupport
161
+ end
162
+
163
+ class Token
164
+ class Representation < Google::Apis::Core::JsonRepresentation; end
165
+
166
+ include Google::Apis::Core::JsonObjectSupport
167
+ end
168
+
169
+ class AnalyzeEntitiesRequest
170
+ # @private
171
+ class Representation < Google::Apis::Core::JsonRepresentation
172
+ property :document, as: 'document', class: Google::Apis::LanguageV1beta2::Document, decorator: Google::Apis::LanguageV1beta2::Document::Representation
173
+
174
+ property :encoding_type, as: 'encodingType'
175
+ end
176
+ end
177
+
178
+ class AnalyzeEntitiesResponse
179
+ # @private
180
+ class Representation < Google::Apis::Core::JsonRepresentation
181
+ collection :entities, as: 'entities', class: Google::Apis::LanguageV1beta2::Entity, decorator: Google::Apis::LanguageV1beta2::Entity::Representation
182
+
183
+ property :language, as: 'language'
184
+ end
185
+ end
186
+
187
+ class AnalyzeEntitySentimentRequest
188
+ # @private
189
+ class Representation < Google::Apis::Core::JsonRepresentation
190
+ property :document, as: 'document', class: Google::Apis::LanguageV1beta2::Document, decorator: Google::Apis::LanguageV1beta2::Document::Representation
191
+
192
+ property :encoding_type, as: 'encodingType'
193
+ end
194
+ end
195
+
196
+ class AnalyzeEntitySentimentResponse
197
+ # @private
198
+ class Representation < Google::Apis::Core::JsonRepresentation
199
+ collection :entities, as: 'entities', class: Google::Apis::LanguageV1beta2::Entity, decorator: Google::Apis::LanguageV1beta2::Entity::Representation
200
+
201
+ property :language, as: 'language'
202
+ end
203
+ end
204
+
205
+ class AnalyzeSentimentRequest
206
+ # @private
207
+ class Representation < Google::Apis::Core::JsonRepresentation
208
+ property :document, as: 'document', class: Google::Apis::LanguageV1beta2::Document, decorator: Google::Apis::LanguageV1beta2::Document::Representation
209
+
210
+ property :encoding_type, as: 'encodingType'
211
+ end
212
+ end
213
+
214
+ class AnalyzeSentimentResponse
215
+ # @private
216
+ class Representation < Google::Apis::Core::JsonRepresentation
217
+ property :document_sentiment, as: 'documentSentiment', class: Google::Apis::LanguageV1beta2::Sentiment, decorator: Google::Apis::LanguageV1beta2::Sentiment::Representation
218
+
219
+ property :language, as: 'language'
220
+ collection :sentences, as: 'sentences', class: Google::Apis::LanguageV1beta2::Sentence, decorator: Google::Apis::LanguageV1beta2::Sentence::Representation
221
+
222
+ end
223
+ end
224
+
225
+ class AnalyzeSyntaxRequest
226
+ # @private
227
+ class Representation < Google::Apis::Core::JsonRepresentation
228
+ property :document, as: 'document', class: Google::Apis::LanguageV1beta2::Document, decorator: Google::Apis::LanguageV1beta2::Document::Representation
229
+
230
+ property :encoding_type, as: 'encodingType'
231
+ end
232
+ end
233
+
234
+ class AnalyzeSyntaxResponse
235
+ # @private
236
+ class Representation < Google::Apis::Core::JsonRepresentation
237
+ property :language, as: 'language'
238
+ collection :sentences, as: 'sentences', class: Google::Apis::LanguageV1beta2::Sentence, decorator: Google::Apis::LanguageV1beta2::Sentence::Representation
239
+
240
+ collection :tokens, as: 'tokens', class: Google::Apis::LanguageV1beta2::Token, decorator: Google::Apis::LanguageV1beta2::Token::Representation
241
+
242
+ end
243
+ end
244
+
245
+ class AnnotateTextRequest
246
+ # @private
247
+ class Representation < Google::Apis::Core::JsonRepresentation
248
+ property :document, as: 'document', class: Google::Apis::LanguageV1beta2::Document, decorator: Google::Apis::LanguageV1beta2::Document::Representation
249
+
250
+ property :encoding_type, as: 'encodingType'
251
+ property :features, as: 'features', class: Google::Apis::LanguageV1beta2::Features, decorator: Google::Apis::LanguageV1beta2::Features::Representation
252
+
253
+ end
254
+ end
255
+
256
+ class AnnotateTextResponse
257
+ # @private
258
+ class Representation < Google::Apis::Core::JsonRepresentation
259
+ collection :categories, as: 'categories', class: Google::Apis::LanguageV1beta2::ClassificationCategory, decorator: Google::Apis::LanguageV1beta2::ClassificationCategory::Representation
260
+
261
+ property :document_sentiment, as: 'documentSentiment', class: Google::Apis::LanguageV1beta2::Sentiment, decorator: Google::Apis::LanguageV1beta2::Sentiment::Representation
262
+
263
+ collection :entities, as: 'entities', class: Google::Apis::LanguageV1beta2::Entity, decorator: Google::Apis::LanguageV1beta2::Entity::Representation
264
+
265
+ property :language, as: 'language'
266
+ collection :sentences, as: 'sentences', class: Google::Apis::LanguageV1beta2::Sentence, decorator: Google::Apis::LanguageV1beta2::Sentence::Representation
267
+
268
+ collection :tokens, as: 'tokens', class: Google::Apis::LanguageV1beta2::Token, decorator: Google::Apis::LanguageV1beta2::Token::Representation
269
+
270
+ end
271
+ end
272
+
273
+ class ClassificationCategory
274
+ # @private
275
+ class Representation < Google::Apis::Core::JsonRepresentation
276
+ property :confidence, as: 'confidence'
277
+ property :name, as: 'name'
278
+ end
279
+ end
280
+
281
+ class ClassifyTextRequest
282
+ # @private
283
+ class Representation < Google::Apis::Core::JsonRepresentation
284
+ property :document, as: 'document', class: Google::Apis::LanguageV1beta2::Document, decorator: Google::Apis::LanguageV1beta2::Document::Representation
285
+
286
+ end
287
+ end
288
+
289
+ class ClassifyTextResponse
290
+ # @private
291
+ class Representation < Google::Apis::Core::JsonRepresentation
292
+ collection :categories, as: 'categories', class: Google::Apis::LanguageV1beta2::ClassificationCategory, decorator: Google::Apis::LanguageV1beta2::ClassificationCategory::Representation
293
+
294
+ end
295
+ end
296
+
297
+ class DependencyEdge
298
+ # @private
299
+ class Representation < Google::Apis::Core::JsonRepresentation
300
+ property :head_token_index, as: 'headTokenIndex'
301
+ property :label, as: 'label'
302
+ end
303
+ end
304
+
305
+ class Document
306
+ # @private
307
+ class Representation < Google::Apis::Core::JsonRepresentation
308
+ property :boilerplate_handling, as: 'boilerplateHandling'
309
+ property :content, as: 'content'
310
+ property :gcs_content_uri, as: 'gcsContentUri'
311
+ property :language, as: 'language'
312
+ property :reference_web_uri, as: 'referenceWebUri'
313
+ property :type, as: 'type'
314
+ end
315
+ end
316
+
317
+ class Entity
318
+ # @private
319
+ class Representation < Google::Apis::Core::JsonRepresentation
320
+ collection :mentions, as: 'mentions', class: Google::Apis::LanguageV1beta2::EntityMention, decorator: Google::Apis::LanguageV1beta2::EntityMention::Representation
321
+
322
+ hash :metadata, as: 'metadata'
323
+ property :name, as: 'name'
324
+ property :salience, as: 'salience'
325
+ property :sentiment, as: 'sentiment', class: Google::Apis::LanguageV1beta2::Sentiment, decorator: Google::Apis::LanguageV1beta2::Sentiment::Representation
326
+
327
+ property :type, as: 'type'
328
+ end
329
+ end
330
+
331
+ class EntityMention
332
+ # @private
333
+ class Representation < Google::Apis::Core::JsonRepresentation
334
+ property :sentiment, as: 'sentiment', class: Google::Apis::LanguageV1beta2::Sentiment, decorator: Google::Apis::LanguageV1beta2::Sentiment::Representation
335
+
336
+ property :text, as: 'text', class: Google::Apis::LanguageV1beta2::TextSpan, decorator: Google::Apis::LanguageV1beta2::TextSpan::Representation
337
+
338
+ property :type, as: 'type'
339
+ end
340
+ end
341
+
342
+ class Features
343
+ # @private
344
+ class Representation < Google::Apis::Core::JsonRepresentation
345
+ property :classify_text, as: 'classifyText'
346
+ property :extract_document_sentiment, as: 'extractDocumentSentiment'
347
+ property :extract_entities, as: 'extractEntities'
348
+ property :extract_entity_sentiment, as: 'extractEntitySentiment'
349
+ property :extract_syntax, as: 'extractSyntax'
350
+ end
351
+ end
352
+
353
+ class PartOfSpeech
354
+ # @private
355
+ class Representation < Google::Apis::Core::JsonRepresentation
356
+ property :aspect, as: 'aspect'
357
+ property :case, as: 'case'
358
+ property :form, as: 'form'
359
+ property :gender, as: 'gender'
360
+ property :mood, as: 'mood'
361
+ property :number, as: 'number'
362
+ property :person, as: 'person'
363
+ property :proper, as: 'proper'
364
+ property :reciprocity, as: 'reciprocity'
365
+ property :tag, as: 'tag'
366
+ property :tense, as: 'tense'
367
+ property :voice, as: 'voice'
368
+ end
369
+ end
370
+
371
+ class Sentence
372
+ # @private
373
+ class Representation < Google::Apis::Core::JsonRepresentation
374
+ property :sentiment, as: 'sentiment', class: Google::Apis::LanguageV1beta2::Sentiment, decorator: Google::Apis::LanguageV1beta2::Sentiment::Representation
375
+
376
+ property :text, as: 'text', class: Google::Apis::LanguageV1beta2::TextSpan, decorator: Google::Apis::LanguageV1beta2::TextSpan::Representation
377
+
378
+ end
379
+ end
380
+
381
+ class Sentiment
382
+ # @private
383
+ class Representation < Google::Apis::Core::JsonRepresentation
384
+ property :magnitude, as: 'magnitude'
385
+ property :score, as: 'score'
386
+ end
387
+ end
388
+
389
+ class Status
390
+ # @private
391
+ class Representation < Google::Apis::Core::JsonRepresentation
392
+ property :code, as: 'code'
393
+ collection :details, as: 'details'
394
+ property :message, as: 'message'
395
+ end
396
+ end
397
+
398
+ class TextSpan
399
+ # @private
400
+ class Representation < Google::Apis::Core::JsonRepresentation
401
+ property :begin_offset, as: 'beginOffset'
402
+ property :content, as: 'content'
403
+ end
404
+ end
405
+
406
+ class Token
407
+ # @private
408
+ class Representation < Google::Apis::Core::JsonRepresentation
409
+ property :dependency_edge, as: 'dependencyEdge', class: Google::Apis::LanguageV1beta2::DependencyEdge, decorator: Google::Apis::LanguageV1beta2::DependencyEdge::Representation
410
+
411
+ property :lemma, as: 'lemma'
412
+ property :part_of_speech, as: 'partOfSpeech', class: Google::Apis::LanguageV1beta2::PartOfSpeech, decorator: Google::Apis::LanguageV1beta2::PartOfSpeech::Representation
413
+
414
+ property :text, as: 'text', class: Google::Apis::LanguageV1beta2::TextSpan, decorator: Google::Apis::LanguageV1beta2::TextSpan::Representation
415
+
416
+ end
417
+ end
418
+ end
419
+ end
420
+ end
@@ -0,0 +1,249 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module LanguageV1beta2
23
+ # Cloud Natural Language API
24
+ #
25
+ # Provides natural language understanding technologies, such as sentiment
26
+ # analysis, entity recognition, entity sentiment analysis, and other text
27
+ # annotations, to developers.
28
+ #
29
+ # @example
30
+ # require 'google/apis/language_v1beta2'
31
+ #
32
+ # Language = Google::Apis::LanguageV1beta2 # Alias the module
33
+ # service = Language::CloudNaturalLanguageService.new
34
+ #
35
+ # @see https://cloud.google.com/natural-language/
36
+ class CloudNaturalLanguageService < Google::Apis::Core::BaseService
37
+ # @return [String]
38
+ # API key. Your API key identifies your project and provides you with API access,
39
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
40
+ attr_accessor :key
41
+
42
+ # @return [String]
43
+ # Available to use for quota purposes for server-side applications. Can be any
44
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
45
+ attr_accessor :quota_user
46
+
47
+ def initialize
48
+ super('https://language.googleapis.com/', '',
49
+ client_name: 'google-apis-language_v1beta2',
50
+ client_version: Google::Apis::LanguageV1beta2::GEM_VERSION)
51
+ @batch_path = 'batch'
52
+ end
53
+
54
+ # Finds named entities (currently proper names and common nouns) in the text
55
+ # along with entity types, salience, mentions for each entity, and other
56
+ # properties.
57
+ # @param [Google::Apis::LanguageV1beta2::AnalyzeEntitiesRequest] analyze_entities_request_object
58
+ # @param [String] fields
59
+ # Selector specifying which fields to include in a partial response.
60
+ # @param [String] quota_user
61
+ # Available to use for quota purposes for server-side applications. Can be any
62
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
63
+ # @param [Google::Apis::RequestOptions] options
64
+ # Request-specific options
65
+ #
66
+ # @yield [result, err] Result & error if block supplied
67
+ # @yieldparam result [Google::Apis::LanguageV1beta2::AnalyzeEntitiesResponse] parsed result object
68
+ # @yieldparam err [StandardError] error object if request failed
69
+ #
70
+ # @return [Google::Apis::LanguageV1beta2::AnalyzeEntitiesResponse]
71
+ #
72
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
73
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
74
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
75
+ def analyze_document_entities(analyze_entities_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
76
+ command = make_simple_command(:post, 'v1beta2/documents:analyzeEntities', options)
77
+ command.request_representation = Google::Apis::LanguageV1beta2::AnalyzeEntitiesRequest::Representation
78
+ command.request_object = analyze_entities_request_object
79
+ command.response_representation = Google::Apis::LanguageV1beta2::AnalyzeEntitiesResponse::Representation
80
+ command.response_class = Google::Apis::LanguageV1beta2::AnalyzeEntitiesResponse
81
+ command.query['fields'] = fields unless fields.nil?
82
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
83
+ execute_or_queue_command(command, &block)
84
+ end
85
+
86
+ # Finds entities, similar to AnalyzeEntities in the text and analyzes sentiment
87
+ # associated with each entity and its mentions.
88
+ # @param [Google::Apis::LanguageV1beta2::AnalyzeEntitySentimentRequest] analyze_entity_sentiment_request_object
89
+ # @param [String] fields
90
+ # Selector specifying which fields to include in a partial response.
91
+ # @param [String] quota_user
92
+ # Available to use for quota purposes for server-side applications. Can be any
93
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
94
+ # @param [Google::Apis::RequestOptions] options
95
+ # Request-specific options
96
+ #
97
+ # @yield [result, err] Result & error if block supplied
98
+ # @yieldparam result [Google::Apis::LanguageV1beta2::AnalyzeEntitySentimentResponse] parsed result object
99
+ # @yieldparam err [StandardError] error object if request failed
100
+ #
101
+ # @return [Google::Apis::LanguageV1beta2::AnalyzeEntitySentimentResponse]
102
+ #
103
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
104
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
105
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
106
+ def analyze_document_entity_sentiment(analyze_entity_sentiment_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
107
+ command = make_simple_command(:post, 'v1beta2/documents:analyzeEntitySentiment', options)
108
+ command.request_representation = Google::Apis::LanguageV1beta2::AnalyzeEntitySentimentRequest::Representation
109
+ command.request_object = analyze_entity_sentiment_request_object
110
+ command.response_representation = Google::Apis::LanguageV1beta2::AnalyzeEntitySentimentResponse::Representation
111
+ command.response_class = Google::Apis::LanguageV1beta2::AnalyzeEntitySentimentResponse
112
+ command.query['fields'] = fields unless fields.nil?
113
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
114
+ execute_or_queue_command(command, &block)
115
+ end
116
+
117
+ # Analyzes the sentiment of the provided text.
118
+ # @param [Google::Apis::LanguageV1beta2::AnalyzeSentimentRequest] analyze_sentiment_request_object
119
+ # @param [String] fields
120
+ # Selector specifying which fields to include in a partial response.
121
+ # @param [String] quota_user
122
+ # Available to use for quota purposes for server-side applications. Can be any
123
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
124
+ # @param [Google::Apis::RequestOptions] options
125
+ # Request-specific options
126
+ #
127
+ # @yield [result, err] Result & error if block supplied
128
+ # @yieldparam result [Google::Apis::LanguageV1beta2::AnalyzeSentimentResponse] parsed result object
129
+ # @yieldparam err [StandardError] error object if request failed
130
+ #
131
+ # @return [Google::Apis::LanguageV1beta2::AnalyzeSentimentResponse]
132
+ #
133
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
134
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
135
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
136
+ def analyze_document_sentiment(analyze_sentiment_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
137
+ command = make_simple_command(:post, 'v1beta2/documents:analyzeSentiment', options)
138
+ command.request_representation = Google::Apis::LanguageV1beta2::AnalyzeSentimentRequest::Representation
139
+ command.request_object = analyze_sentiment_request_object
140
+ command.response_representation = Google::Apis::LanguageV1beta2::AnalyzeSentimentResponse::Representation
141
+ command.response_class = Google::Apis::LanguageV1beta2::AnalyzeSentimentResponse
142
+ command.query['fields'] = fields unless fields.nil?
143
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
144
+ execute_or_queue_command(command, &block)
145
+ end
146
+
147
+ # Analyzes the syntax of the text and provides sentence boundaries and
148
+ # tokenization along with part of speech tags, dependency trees, and other
149
+ # properties.
150
+ # @param [Google::Apis::LanguageV1beta2::AnalyzeSyntaxRequest] analyze_syntax_request_object
151
+ # @param [String] fields
152
+ # Selector specifying which fields to include in a partial response.
153
+ # @param [String] quota_user
154
+ # Available to use for quota purposes for server-side applications. Can be any
155
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
156
+ # @param [Google::Apis::RequestOptions] options
157
+ # Request-specific options
158
+ #
159
+ # @yield [result, err] Result & error if block supplied
160
+ # @yieldparam result [Google::Apis::LanguageV1beta2::AnalyzeSyntaxResponse] parsed result object
161
+ # @yieldparam err [StandardError] error object if request failed
162
+ #
163
+ # @return [Google::Apis::LanguageV1beta2::AnalyzeSyntaxResponse]
164
+ #
165
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
166
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
167
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
168
+ def analyze_document_syntax(analyze_syntax_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
169
+ command = make_simple_command(:post, 'v1beta2/documents:analyzeSyntax', options)
170
+ command.request_representation = Google::Apis::LanguageV1beta2::AnalyzeSyntaxRequest::Representation
171
+ command.request_object = analyze_syntax_request_object
172
+ command.response_representation = Google::Apis::LanguageV1beta2::AnalyzeSyntaxResponse::Representation
173
+ command.response_class = Google::Apis::LanguageV1beta2::AnalyzeSyntaxResponse
174
+ command.query['fields'] = fields unless fields.nil?
175
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
176
+ execute_or_queue_command(command, &block)
177
+ end
178
+
179
+ # A convenience method that provides all syntax, sentiment, entity, and
180
+ # classification features in one call.
181
+ # @param [Google::Apis::LanguageV1beta2::AnnotateTextRequest] annotate_text_request_object
182
+ # @param [String] fields
183
+ # Selector specifying which fields to include in a partial response.
184
+ # @param [String] quota_user
185
+ # Available to use for quota purposes for server-side applications. Can be any
186
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
187
+ # @param [Google::Apis::RequestOptions] options
188
+ # Request-specific options
189
+ #
190
+ # @yield [result, err] Result & error if block supplied
191
+ # @yieldparam result [Google::Apis::LanguageV1beta2::AnnotateTextResponse] parsed result object
192
+ # @yieldparam err [StandardError] error object if request failed
193
+ #
194
+ # @return [Google::Apis::LanguageV1beta2::AnnotateTextResponse]
195
+ #
196
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
197
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
198
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
199
+ def annotate_document_text(annotate_text_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
200
+ command = make_simple_command(:post, 'v1beta2/documents:annotateText', options)
201
+ command.request_representation = Google::Apis::LanguageV1beta2::AnnotateTextRequest::Representation
202
+ command.request_object = annotate_text_request_object
203
+ command.response_representation = Google::Apis::LanguageV1beta2::AnnotateTextResponse::Representation
204
+ command.response_class = Google::Apis::LanguageV1beta2::AnnotateTextResponse
205
+ command.query['fields'] = fields unless fields.nil?
206
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
207
+ execute_or_queue_command(command, &block)
208
+ end
209
+
210
+ # Classifies a document into categories.
211
+ # @param [Google::Apis::LanguageV1beta2::ClassifyTextRequest] classify_text_request_object
212
+ # @param [String] fields
213
+ # Selector specifying which fields to include in a partial response.
214
+ # @param [String] quota_user
215
+ # Available to use for quota purposes for server-side applications. Can be any
216
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
217
+ # @param [Google::Apis::RequestOptions] options
218
+ # Request-specific options
219
+ #
220
+ # @yield [result, err] Result & error if block supplied
221
+ # @yieldparam result [Google::Apis::LanguageV1beta2::ClassifyTextResponse] parsed result object
222
+ # @yieldparam err [StandardError] error object if request failed
223
+ #
224
+ # @return [Google::Apis::LanguageV1beta2::ClassifyTextResponse]
225
+ #
226
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
227
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
228
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
229
+ def classify_document_text(classify_text_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
230
+ command = make_simple_command(:post, 'v1beta2/documents:classifyText', options)
231
+ command.request_representation = Google::Apis::LanguageV1beta2::ClassifyTextRequest::Representation
232
+ command.request_object = classify_text_request_object
233
+ command.response_representation = Google::Apis::LanguageV1beta2::ClassifyTextResponse::Representation
234
+ command.response_class = Google::Apis::LanguageV1beta2::ClassifyTextResponse
235
+ command.query['fields'] = fields unless fields.nil?
236
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
237
+ execute_or_queue_command(command, &block)
238
+ end
239
+
240
+ protected
241
+
242
+ def apply_command_defaults(command)
243
+ command.query['key'] = key unless key.nil?
244
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
245
+ end
246
+ end
247
+ end
248
+ end
249
+ end