google-apis-language_v1 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +13 -0
- data/CHANGELOG.md +7 -0
- data/LICENSE.md +202 -0
- data/OVERVIEW.md +96 -0
- data/lib/google-apis-language_v1.rb +15 -0
- data/lib/google/apis/language_v1.rb +41 -0
- data/lib/google/apis/language_v1/classes.rb +861 -0
- data/lib/google/apis/language_v1/gem_version.rb +28 -0
- data/lib/google/apis/language_v1/representations.rb +418 -0
- data/lib/google/apis/language_v1/service.rb +249 -0
- metadata +76 -0
@@ -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 LanguageV1
|
18
|
+
# Version of the google-apis-language_v1 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,418 @@
|
|
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 LanguageV1
|
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::LanguageV1::Document, decorator: Google::Apis::LanguageV1::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::LanguageV1::Entity, decorator: Google::Apis::LanguageV1::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::LanguageV1::Document, decorator: Google::Apis::LanguageV1::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::LanguageV1::Entity, decorator: Google::Apis::LanguageV1::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::LanguageV1::Document, decorator: Google::Apis::LanguageV1::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::LanguageV1::Sentiment, decorator: Google::Apis::LanguageV1::Sentiment::Representation
|
218
|
+
|
219
|
+
property :language, as: 'language'
|
220
|
+
collection :sentences, as: 'sentences', class: Google::Apis::LanguageV1::Sentence, decorator: Google::Apis::LanguageV1::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::LanguageV1::Document, decorator: Google::Apis::LanguageV1::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::LanguageV1::Sentence, decorator: Google::Apis::LanguageV1::Sentence::Representation
|
239
|
+
|
240
|
+
collection :tokens, as: 'tokens', class: Google::Apis::LanguageV1::Token, decorator: Google::Apis::LanguageV1::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::LanguageV1::Document, decorator: Google::Apis::LanguageV1::Document::Representation
|
249
|
+
|
250
|
+
property :encoding_type, as: 'encodingType'
|
251
|
+
property :features, as: 'features', class: Google::Apis::LanguageV1::Features, decorator: Google::Apis::LanguageV1::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::LanguageV1::ClassificationCategory, decorator: Google::Apis::LanguageV1::ClassificationCategory::Representation
|
260
|
+
|
261
|
+
property :document_sentiment, as: 'documentSentiment', class: Google::Apis::LanguageV1::Sentiment, decorator: Google::Apis::LanguageV1::Sentiment::Representation
|
262
|
+
|
263
|
+
collection :entities, as: 'entities', class: Google::Apis::LanguageV1::Entity, decorator: Google::Apis::LanguageV1::Entity::Representation
|
264
|
+
|
265
|
+
property :language, as: 'language'
|
266
|
+
collection :sentences, as: 'sentences', class: Google::Apis::LanguageV1::Sentence, decorator: Google::Apis::LanguageV1::Sentence::Representation
|
267
|
+
|
268
|
+
collection :tokens, as: 'tokens', class: Google::Apis::LanguageV1::Token, decorator: Google::Apis::LanguageV1::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::LanguageV1::Document, decorator: Google::Apis::LanguageV1::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::LanguageV1::ClassificationCategory, decorator: Google::Apis::LanguageV1::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 :content, as: 'content'
|
309
|
+
property :gcs_content_uri, as: 'gcsContentUri'
|
310
|
+
property :language, as: 'language'
|
311
|
+
property :type, as: 'type'
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
class Entity
|
316
|
+
# @private
|
317
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
318
|
+
collection :mentions, as: 'mentions', class: Google::Apis::LanguageV1::EntityMention, decorator: Google::Apis::LanguageV1::EntityMention::Representation
|
319
|
+
|
320
|
+
hash :metadata, as: 'metadata'
|
321
|
+
property :name, as: 'name'
|
322
|
+
property :salience, as: 'salience'
|
323
|
+
property :sentiment, as: 'sentiment', class: Google::Apis::LanguageV1::Sentiment, decorator: Google::Apis::LanguageV1::Sentiment::Representation
|
324
|
+
|
325
|
+
property :type, as: 'type'
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|
329
|
+
class EntityMention
|
330
|
+
# @private
|
331
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
332
|
+
property :sentiment, as: 'sentiment', class: Google::Apis::LanguageV1::Sentiment, decorator: Google::Apis::LanguageV1::Sentiment::Representation
|
333
|
+
|
334
|
+
property :text, as: 'text', class: Google::Apis::LanguageV1::TextSpan, decorator: Google::Apis::LanguageV1::TextSpan::Representation
|
335
|
+
|
336
|
+
property :type, as: 'type'
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
class Features
|
341
|
+
# @private
|
342
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
343
|
+
property :classify_text, as: 'classifyText'
|
344
|
+
property :extract_document_sentiment, as: 'extractDocumentSentiment'
|
345
|
+
property :extract_entities, as: 'extractEntities'
|
346
|
+
property :extract_entity_sentiment, as: 'extractEntitySentiment'
|
347
|
+
property :extract_syntax, as: 'extractSyntax'
|
348
|
+
end
|
349
|
+
end
|
350
|
+
|
351
|
+
class PartOfSpeech
|
352
|
+
# @private
|
353
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
354
|
+
property :aspect, as: 'aspect'
|
355
|
+
property :case, as: 'case'
|
356
|
+
property :form, as: 'form'
|
357
|
+
property :gender, as: 'gender'
|
358
|
+
property :mood, as: 'mood'
|
359
|
+
property :number, as: 'number'
|
360
|
+
property :person, as: 'person'
|
361
|
+
property :proper, as: 'proper'
|
362
|
+
property :reciprocity, as: 'reciprocity'
|
363
|
+
property :tag, as: 'tag'
|
364
|
+
property :tense, as: 'tense'
|
365
|
+
property :voice, as: 'voice'
|
366
|
+
end
|
367
|
+
end
|
368
|
+
|
369
|
+
class Sentence
|
370
|
+
# @private
|
371
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
372
|
+
property :sentiment, as: 'sentiment', class: Google::Apis::LanguageV1::Sentiment, decorator: Google::Apis::LanguageV1::Sentiment::Representation
|
373
|
+
|
374
|
+
property :text, as: 'text', class: Google::Apis::LanguageV1::TextSpan, decorator: Google::Apis::LanguageV1::TextSpan::Representation
|
375
|
+
|
376
|
+
end
|
377
|
+
end
|
378
|
+
|
379
|
+
class Sentiment
|
380
|
+
# @private
|
381
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
382
|
+
property :magnitude, as: 'magnitude'
|
383
|
+
property :score, as: 'score'
|
384
|
+
end
|
385
|
+
end
|
386
|
+
|
387
|
+
class Status
|
388
|
+
# @private
|
389
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
390
|
+
property :code, as: 'code'
|
391
|
+
collection :details, as: 'details'
|
392
|
+
property :message, as: 'message'
|
393
|
+
end
|
394
|
+
end
|
395
|
+
|
396
|
+
class TextSpan
|
397
|
+
# @private
|
398
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
399
|
+
property :begin_offset, as: 'beginOffset'
|
400
|
+
property :content, as: 'content'
|
401
|
+
end
|
402
|
+
end
|
403
|
+
|
404
|
+
class Token
|
405
|
+
# @private
|
406
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
407
|
+
property :dependency_edge, as: 'dependencyEdge', class: Google::Apis::LanguageV1::DependencyEdge, decorator: Google::Apis::LanguageV1::DependencyEdge::Representation
|
408
|
+
|
409
|
+
property :lemma, as: 'lemma'
|
410
|
+
property :part_of_speech, as: 'partOfSpeech', class: Google::Apis::LanguageV1::PartOfSpeech, decorator: Google::Apis::LanguageV1::PartOfSpeech::Representation
|
411
|
+
|
412
|
+
property :text, as: 'text', class: Google::Apis::LanguageV1::TextSpan, decorator: Google::Apis::LanguageV1::TextSpan::Representation
|
413
|
+
|
414
|
+
end
|
415
|
+
end
|
416
|
+
end
|
417
|
+
end
|
418
|
+
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 LanguageV1
|
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_v1'
|
31
|
+
#
|
32
|
+
# Language = Google::Apis::LanguageV1 # 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_v1',
|
50
|
+
client_version: Google::Apis::LanguageV1::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::LanguageV1::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::LanguageV1::AnalyzeEntitiesResponse] parsed result object
|
68
|
+
# @yieldparam err [StandardError] error object if request failed
|
69
|
+
#
|
70
|
+
# @return [Google::Apis::LanguageV1::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, 'v1/documents:analyzeEntities', options)
|
77
|
+
command.request_representation = Google::Apis::LanguageV1::AnalyzeEntitiesRequest::Representation
|
78
|
+
command.request_object = analyze_entities_request_object
|
79
|
+
command.response_representation = Google::Apis::LanguageV1::AnalyzeEntitiesResponse::Representation
|
80
|
+
command.response_class = Google::Apis::LanguageV1::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::LanguageV1::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::LanguageV1::AnalyzeEntitySentimentResponse] parsed result object
|
99
|
+
# @yieldparam err [StandardError] error object if request failed
|
100
|
+
#
|
101
|
+
# @return [Google::Apis::LanguageV1::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, 'v1/documents:analyzeEntitySentiment', options)
|
108
|
+
command.request_representation = Google::Apis::LanguageV1::AnalyzeEntitySentimentRequest::Representation
|
109
|
+
command.request_object = analyze_entity_sentiment_request_object
|
110
|
+
command.response_representation = Google::Apis::LanguageV1::AnalyzeEntitySentimentResponse::Representation
|
111
|
+
command.response_class = Google::Apis::LanguageV1::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::LanguageV1::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::LanguageV1::AnalyzeSentimentResponse] parsed result object
|
129
|
+
# @yieldparam err [StandardError] error object if request failed
|
130
|
+
#
|
131
|
+
# @return [Google::Apis::LanguageV1::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, 'v1/documents:analyzeSentiment', options)
|
138
|
+
command.request_representation = Google::Apis::LanguageV1::AnalyzeSentimentRequest::Representation
|
139
|
+
command.request_object = analyze_sentiment_request_object
|
140
|
+
command.response_representation = Google::Apis::LanguageV1::AnalyzeSentimentResponse::Representation
|
141
|
+
command.response_class = Google::Apis::LanguageV1::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::LanguageV1::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::LanguageV1::AnalyzeSyntaxResponse] parsed result object
|
161
|
+
# @yieldparam err [StandardError] error object if request failed
|
162
|
+
#
|
163
|
+
# @return [Google::Apis::LanguageV1::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, 'v1/documents:analyzeSyntax', options)
|
170
|
+
command.request_representation = Google::Apis::LanguageV1::AnalyzeSyntaxRequest::Representation
|
171
|
+
command.request_object = analyze_syntax_request_object
|
172
|
+
command.response_representation = Google::Apis::LanguageV1::AnalyzeSyntaxResponse::Representation
|
173
|
+
command.response_class = Google::Apis::LanguageV1::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 the features that analyzeSentiment,
|
180
|
+
# analyzeEntities, and analyzeSyntax provide in one call.
|
181
|
+
# @param [Google::Apis::LanguageV1::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::LanguageV1::AnnotateTextResponse] parsed result object
|
192
|
+
# @yieldparam err [StandardError] error object if request failed
|
193
|
+
#
|
194
|
+
# @return [Google::Apis::LanguageV1::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, 'v1/documents:annotateText', options)
|
201
|
+
command.request_representation = Google::Apis::LanguageV1::AnnotateTextRequest::Representation
|
202
|
+
command.request_object = annotate_text_request_object
|
203
|
+
command.response_representation = Google::Apis::LanguageV1::AnnotateTextResponse::Representation
|
204
|
+
command.response_class = Google::Apis::LanguageV1::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::LanguageV1::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::LanguageV1::ClassifyTextResponse] parsed result object
|
222
|
+
# @yieldparam err [StandardError] error object if request failed
|
223
|
+
#
|
224
|
+
# @return [Google::Apis::LanguageV1::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, 'v1/documents:classifyText', options)
|
231
|
+
command.request_representation = Google::Apis::LanguageV1::ClassifyTextRequest::Representation
|
232
|
+
command.request_object = classify_text_request_object
|
233
|
+
command.response_representation = Google::Apis::LanguageV1::ClassifyTextResponse::Representation
|
234
|
+
command.response_class = Google::Apis::LanguageV1::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
|