google-cloud-language-v1 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +48 -1
- data/lib/google/cloud/language/v1/language_service/client.rb +67 -47
- data/lib/google/cloud/language/v1/language_service.rb +30 -1
- data/lib/google/cloud/language/v1/version.rb +1 -1
- data/lib/google/cloud/language/v1.rb +16 -0
- data/lib/google-cloud-language-v1.rb +21 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa9b3392a6c79b5a1467f83355581382dbf1de2b85235425f7323687cb0f6c54
|
4
|
+
data.tar.gz: 9499739748001e7af7d649ed3b377c4c98740725efddccca867e8055c6751f88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 369c5a657a3e4e4b312fb8c8bc85568e1a1332353bca99a3b01279f4f772db34b968df36f5b839a45a449de0eb267b81299f5490ada8cca4b38f2ba0fbe5d822
|
7
|
+
data.tar.gz: d03a8dc9f2b7e479f1265a171ec59f5d308a0558c8cf65495b516358d3ce5950862150abbfe23967e0f42a0918811178f805822871cf9fa874643b8c75c3377e
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Natural Language V1
|
1
|
+
# Ruby Client for the Natural Language V1 API
|
2
2
|
|
3
3
|
API Client library for the Natural Language V1 API
|
4
4
|
|
@@ -12,6 +12,53 @@ https://github.com/googleapis/google-cloud-ruby
|
|
12
12
|
$ gem install google-cloud-language-v1
|
13
13
|
```
|
14
14
|
|
15
|
+
## Before You Begin
|
16
|
+
|
17
|
+
In order to use this library, you first need to go through the following steps:
|
18
|
+
|
19
|
+
1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
20
|
+
1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
21
|
+
1. {file:AUTHENTICATION.md Set up authentication.}
|
22
|
+
|
23
|
+
## Quick Start
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
require "google/cloud/language/v1"
|
27
|
+
|
28
|
+
client = Google::Cloud::Language::V1::LanguageService::Client.new
|
29
|
+
request = my_create_request
|
30
|
+
response = client.analyze_sentiment request
|
31
|
+
```
|
32
|
+
|
33
|
+
View the [Client Library Documentation](https://googleapis.dev/ruby/google-cloud-language-v1/latest)
|
34
|
+
for class and method documentation.
|
35
|
+
|
36
|
+
## Enabling Logging
|
37
|
+
|
38
|
+
To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
39
|
+
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
|
40
|
+
or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
41
|
+
that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
42
|
+
and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
43
|
+
|
44
|
+
Configuring a Ruby stdlib logger:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
require "logger"
|
48
|
+
|
49
|
+
module MyLogger
|
50
|
+
LOGGER = Logger.new $stderr, level: Logger::WARN
|
51
|
+
def logger
|
52
|
+
LOGGER
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
57
|
+
module GRPC
|
58
|
+
extend MyLogger
|
59
|
+
end
|
60
|
+
```
|
61
|
+
|
15
62
|
## Supported Ruby Versions
|
16
63
|
|
17
64
|
This library is supported on Ruby 2.4+.
|
@@ -16,14 +16,8 @@
|
|
16
16
|
|
17
17
|
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
18
|
|
19
|
-
require "gapic/common"
|
20
|
-
require "gapic/config"
|
21
|
-
require "gapic/config/method"
|
22
|
-
|
23
19
|
require "google/cloud/errors"
|
24
|
-
require "google/cloud/language/v1/version"
|
25
20
|
require "google/cloud/language/v1/language_service_pb"
|
26
|
-
require "google/cloud/language/v1/language_service/credentials"
|
27
21
|
|
28
22
|
module Google
|
29
23
|
module Cloud
|
@@ -200,18 +194,25 @@ module Google
|
|
200
194
|
# Analyzes the sentiment of the provided text.
|
201
195
|
#
|
202
196
|
# @overload analyze_sentiment(request, options = nil)
|
203
|
-
#
|
204
|
-
#
|
197
|
+
# Pass arguments to `analyze_sentiment` via a request object, either of type
|
198
|
+
# {Google::Cloud::Language::V1::AnalyzeSentimentRequest} or an equivalent Hash.
|
199
|
+
#
|
200
|
+
# @param request [Google::Cloud::Language::V1::AnalyzeSentimentRequest, Hash]
|
201
|
+
# A request object representing the call parameters. Required. To specify no
|
202
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
205
203
|
# @param options [Gapic::CallOptions, Hash]
|
206
204
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
207
205
|
#
|
208
206
|
# @overload analyze_sentiment(document: nil, encoding_type: nil)
|
209
|
-
#
|
207
|
+
# Pass arguments to `analyze_sentiment` via keyword arguments. Note that at
|
208
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
209
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
210
|
+
#
|
211
|
+
# @param document [Google::Cloud::Language::V1::Document, Hash]
|
210
212
|
# Input document.
|
211
213
|
# @param encoding_type [Google::Cloud::Language::V1::EncodingType]
|
212
214
|
# The encoding type used by the API to calculate sentence offsets.
|
213
215
|
#
|
214
|
-
#
|
215
216
|
# @yield [response, operation] Access the result along with the RPC operation
|
216
217
|
# @yieldparam response [Google::Cloud::Language::V1::AnalyzeSentimentResponse]
|
217
218
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -257,20 +258,25 @@ module Google
|
|
257
258
|
# other properties.
|
258
259
|
#
|
259
260
|
# @overload analyze_entities(request, options = nil)
|
260
|
-
#
|
261
|
-
#
|
262
|
-
#
|
263
|
-
#
|
261
|
+
# Pass arguments to `analyze_entities` via a request object, either of type
|
262
|
+
# {Google::Cloud::Language::V1::AnalyzeEntitiesRequest} or an equivalent Hash.
|
263
|
+
#
|
264
|
+
# @param request [Google::Cloud::Language::V1::AnalyzeEntitiesRequest, Hash]
|
265
|
+
# A request object representing the call parameters. Required. To specify no
|
266
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
264
267
|
# @param options [Gapic::CallOptions, Hash]
|
265
268
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
266
269
|
#
|
267
270
|
# @overload analyze_entities(document: nil, encoding_type: nil)
|
268
|
-
#
|
271
|
+
# Pass arguments to `analyze_entities` via keyword arguments. Note that at
|
272
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
273
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
274
|
+
#
|
275
|
+
# @param document [Google::Cloud::Language::V1::Document, Hash]
|
269
276
|
# Input document.
|
270
277
|
# @param encoding_type [Google::Cloud::Language::V1::EncodingType]
|
271
278
|
# The encoding type used by the API to calculate offsets.
|
272
279
|
#
|
273
|
-
#
|
274
280
|
# @yield [response, operation] Access the result along with the RPC operation
|
275
281
|
# @yieldparam response [Google::Cloud::Language::V1::AnalyzeEntitiesResponse]
|
276
282
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -315,19 +321,25 @@ module Google
|
|
315
321
|
# sentiment associated with each entity and its mentions.
|
316
322
|
#
|
317
323
|
# @overload analyze_entity_sentiment(request, options = nil)
|
318
|
-
#
|
319
|
-
#
|
320
|
-
#
|
324
|
+
# Pass arguments to `analyze_entity_sentiment` via a request object, either of type
|
325
|
+
# {Google::Cloud::Language::V1::AnalyzeEntitySentimentRequest} or an equivalent Hash.
|
326
|
+
#
|
327
|
+
# @param request [Google::Cloud::Language::V1::AnalyzeEntitySentimentRequest, Hash]
|
328
|
+
# A request object representing the call parameters. Required. To specify no
|
329
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
321
330
|
# @param options [Gapic::CallOptions, Hash]
|
322
331
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
323
332
|
#
|
324
333
|
# @overload analyze_entity_sentiment(document: nil, encoding_type: nil)
|
325
|
-
#
|
334
|
+
# Pass arguments to `analyze_entity_sentiment` via keyword arguments. Note that at
|
335
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
336
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
337
|
+
#
|
338
|
+
# @param document [Google::Cloud::Language::V1::Document, Hash]
|
326
339
|
# Input document.
|
327
340
|
# @param encoding_type [Google::Cloud::Language::V1::EncodingType]
|
328
341
|
# The encoding type used by the API to calculate offsets.
|
329
342
|
#
|
330
|
-
#
|
331
343
|
# @yield [response, operation] Access the result along with the RPC operation
|
332
344
|
# @yieldparam response [Google::Cloud::Language::V1::AnalyzeEntitySentimentResponse]
|
333
345
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -373,20 +385,25 @@ module Google
|
|
373
385
|
# properties.
|
374
386
|
#
|
375
387
|
# @overload analyze_syntax(request, options = nil)
|
376
|
-
#
|
377
|
-
#
|
378
|
-
#
|
379
|
-
#
|
388
|
+
# Pass arguments to `analyze_syntax` via a request object, either of type
|
389
|
+
# {Google::Cloud::Language::V1::AnalyzeSyntaxRequest} or an equivalent Hash.
|
390
|
+
#
|
391
|
+
# @param request [Google::Cloud::Language::V1::AnalyzeSyntaxRequest, Hash]
|
392
|
+
# A request object representing the call parameters. Required. To specify no
|
393
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
380
394
|
# @param options [Gapic::CallOptions, Hash]
|
381
395
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
382
396
|
#
|
383
397
|
# @overload analyze_syntax(document: nil, encoding_type: nil)
|
384
|
-
#
|
398
|
+
# Pass arguments to `analyze_syntax` via keyword arguments. Note that at
|
399
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
400
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
401
|
+
#
|
402
|
+
# @param document [Google::Cloud::Language::V1::Document, Hash]
|
385
403
|
# Input document.
|
386
404
|
# @param encoding_type [Google::Cloud::Language::V1::EncodingType]
|
387
405
|
# The encoding type used by the API to calculate offsets.
|
388
406
|
#
|
389
|
-
#
|
390
407
|
# @yield [response, operation] Access the result along with the RPC operation
|
391
408
|
# @yieldparam response [Google::Cloud::Language::V1::AnalyzeSyntaxResponse]
|
392
409
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -430,15 +447,22 @@ module Google
|
|
430
447
|
# Classifies a document into categories.
|
431
448
|
#
|
432
449
|
# @overload classify_text(request, options = nil)
|
433
|
-
#
|
434
|
-
#
|
450
|
+
# Pass arguments to `classify_text` via a request object, either of type
|
451
|
+
# {Google::Cloud::Language::V1::ClassifyTextRequest} or an equivalent Hash.
|
452
|
+
#
|
453
|
+
# @param request [Google::Cloud::Language::V1::ClassifyTextRequest, Hash]
|
454
|
+
# A request object representing the call parameters. Required. To specify no
|
455
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
435
456
|
# @param options [Gapic::CallOptions, Hash]
|
436
457
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
437
458
|
#
|
438
459
|
# @overload classify_text(document: nil)
|
439
|
-
#
|
440
|
-
#
|
460
|
+
# Pass arguments to `classify_text` via keyword arguments. Note that at
|
461
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
462
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
441
463
|
#
|
464
|
+
# @param document [Google::Cloud::Language::V1::Document, Hash]
|
465
|
+
# Input document.
|
442
466
|
#
|
443
467
|
# @yield [response, operation] Access the result along with the RPC operation
|
444
468
|
# @yieldparam response [Google::Cloud::Language::V1::ClassifyTextResponse]
|
@@ -484,21 +508,27 @@ module Google
|
|
484
508
|
# analyzeEntities, and analyzeSyntax provide in one call.
|
485
509
|
#
|
486
510
|
# @overload annotate_text(request, options = nil)
|
487
|
-
#
|
488
|
-
#
|
489
|
-
#
|
511
|
+
# Pass arguments to `annotate_text` via a request object, either of type
|
512
|
+
# {Google::Cloud::Language::V1::AnnotateTextRequest} or an equivalent Hash.
|
513
|
+
#
|
514
|
+
# @param request [Google::Cloud::Language::V1::AnnotateTextRequest, Hash]
|
515
|
+
# A request object representing the call parameters. Required. To specify no
|
516
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
490
517
|
# @param options [Gapic::CallOptions, Hash]
|
491
518
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
492
519
|
#
|
493
520
|
# @overload annotate_text(document: nil, features: nil, encoding_type: nil)
|
494
|
-
#
|
521
|
+
# Pass arguments to `annotate_text` via keyword arguments. Note that at
|
522
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
523
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
524
|
+
#
|
525
|
+
# @param document [Google::Cloud::Language::V1::Document, Hash]
|
495
526
|
# Input document.
|
496
|
-
# @param features [Google::Cloud::Language::V1::AnnotateTextRequest::Features
|
527
|
+
# @param features [Google::Cloud::Language::V1::AnnotateTextRequest::Features, Hash]
|
497
528
|
# The enabled features.
|
498
529
|
# @param encoding_type [Google::Cloud::Language::V1::EncodingType]
|
499
530
|
# The encoding type used by the API to calculate offsets.
|
500
531
|
#
|
501
|
-
#
|
502
532
|
# @yield [response, operation] Access the result along with the RPC operation
|
503
533
|
# @yieldparam response [Google::Cloud::Language::V1::AnnotateTextResponse]
|
504
534
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -726,13 +756,3 @@ module Google
|
|
726
756
|
end
|
727
757
|
end
|
728
758
|
end
|
729
|
-
|
730
|
-
# rubocop:disable Lint/HandleExceptions
|
731
|
-
|
732
|
-
# Once client is loaded, load helpers.rb if it exists.
|
733
|
-
begin
|
734
|
-
require "google/cloud/language/v1/language_service/helpers"
|
735
|
-
rescue LoadError
|
736
|
-
end
|
737
|
-
|
738
|
-
# rubocop:enable Lint/HandleExceptions
|
@@ -16,5 +16,34 @@
|
|
16
16
|
|
17
17
|
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
18
|
|
19
|
-
require "
|
19
|
+
require "gapic/common"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/language/v1/version"
|
24
|
+
|
20
25
|
require "google/cloud/language/v1/language_service/credentials"
|
26
|
+
require "google/cloud/language/v1/language_service/client"
|
27
|
+
|
28
|
+
module Google
|
29
|
+
module Cloud
|
30
|
+
module Language
|
31
|
+
module V1
|
32
|
+
##
|
33
|
+
# Provides text analysis operations such as sentiment analysis and entity
|
34
|
+
# recognition.
|
35
|
+
#
|
36
|
+
# To load this service and instantiate a client:
|
37
|
+
#
|
38
|
+
# require "google/cloud/language/v1/language_service"
|
39
|
+
# client = Google::Cloud::Language::V1::LanguageService::Client.new
|
40
|
+
#
|
41
|
+
module LanguageService
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
helper_path = ::File.join __dir__, "language_service", "helpers.rb"
|
49
|
+
require "google/cloud/language/v1/language_service/helpers" if ::File.file? helper_path
|
@@ -17,3 +17,19 @@
|
|
17
17
|
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
18
|
|
19
19
|
require "google/cloud/language/v1/language_service"
|
20
|
+
require "google/cloud/language/v1/version"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Language
|
25
|
+
##
|
26
|
+
# To load this package, including all its services, and instantiate a client:
|
27
|
+
#
|
28
|
+
# require "google/cloud/language/v1"
|
29
|
+
# client = Google::Cloud::Language::V1::LanguageService::Client.new
|
30
|
+
#
|
31
|
+
module V1
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -1 +1,21 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 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
|
+
# This gem does not autoload during Bundler.require. To load this gem,
|
20
|
+
# issue explicit require statements for the packages desired, e.g.:
|
21
|
+
# require "google/cloud/language/v1"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-language-v1
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gapic-common
|