google-cloud-language-v1beta2 0.6.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/google/cloud/language/v1beta2/language_service/client.rb +90 -4
- data/lib/google/cloud/language/v1beta2/language_service/rest/client.rb +811 -0
- data/lib/google/cloud/language/v1beta2/language_service/rest/service_stub.rb +454 -0
- data/lib/google/cloud/language/v1beta2/language_service/rest.rb +52 -0
- data/lib/google/cloud/language/v1beta2/language_service.rb +7 -1
- data/lib/google/cloud/language/v1beta2/language_service_pb.rb +26 -369
- data/lib/google/cloud/language/v1beta2/language_service_services_pb.rb +6 -2
- data/lib/google/cloud/language/v1beta2/rest.rb +37 -0
- data/lib/google/cloud/language/v1beta2/version.rb +1 -1
- data/lib/google/cloud/language/v1beta2.rb +7 -2
- data/proto_docs/google/api/client.rb +381 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/cloud/language/v1beta2/language_service.rb +47 -17
- data/proto_docs/google/protobuf/duration.rb +98 -0
- metadata +16 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f97b1bd17892d0675f958d4f101cf1a19e29c76e9e0e894cda907a05d2e3fa7c
|
4
|
+
data.tar.gz: 3784d4dc0d0ae8c5bad2b096018afe29c6a6aa861a3b015be46bc464358dd660
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79a88b85924c5906ba67cd54197074398a4ad306550d637a1efee9ec5d28dc9d0e6a3ebef6d454ee6faa39b970f41d69e895f7aff9a0e5d75f522071320ab2fd
|
7
|
+
data.tar.gz: e3318da9c43546ab0c9bbc9db94059c742a75676688492684600ecf8af0c0f9e8b5993d53ef81bdbaaa8ad6e72775cf079f649e88240a029c5872befe2ebb23a
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Ruby Client for the Natural Language V1beta2 API
|
2
2
|
|
3
|
-
|
3
|
+
Provides natural language understanding technologies, such as sentiment analysis, entity recognition, entity sentiment analysis, and other text annotations, to developers.
|
4
4
|
|
5
5
|
Provides natural language understanding technologies, such as sentiment analysis, entity recognition, entity sentiment analysis, and other text annotations.
|
6
6
|
|
@@ -46,8 +46,8 @@ for general usage information.
|
|
46
46
|
## Enabling Logging
|
47
47
|
|
48
48
|
To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
49
|
-
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/
|
50
|
-
or a [`Google::Cloud::Logging::Logger`](https://
|
49
|
+
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
|
50
|
+
or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
|
51
51
|
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)
|
52
52
|
and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
53
53
|
|
@@ -335,8 +335,10 @@ module Google
|
|
335
335
|
end
|
336
336
|
|
337
337
|
##
|
338
|
-
# Finds entities, similar to
|
339
|
-
#
|
338
|
+
# Finds entities, similar to
|
339
|
+
# {::Google::Cloud::Language::V1beta2::LanguageService::Client#analyze_entities AnalyzeEntities}
|
340
|
+
# in the text and analyzes sentiment associated with each entity and its
|
341
|
+
# mentions.
|
340
342
|
#
|
341
343
|
# @overload analyze_entity_sentiment(request, options = nil)
|
342
344
|
# Pass arguments to `analyze_entity_sentiment` via a request object, either of type
|
@@ -575,6 +577,83 @@ module Google
|
|
575
577
|
raise ::Google::Cloud::Error.from_error(e)
|
576
578
|
end
|
577
579
|
|
580
|
+
##
|
581
|
+
# Moderates a document for harmful and sensitive categories.
|
582
|
+
#
|
583
|
+
# @overload moderate_text(request, options = nil)
|
584
|
+
# Pass arguments to `moderate_text` via a request object, either of type
|
585
|
+
# {::Google::Cloud::Language::V1beta2::ModerateTextRequest} or an equivalent Hash.
|
586
|
+
#
|
587
|
+
# @param request [::Google::Cloud::Language::V1beta2::ModerateTextRequest, ::Hash]
|
588
|
+
# A request object representing the call parameters. Required. To specify no
|
589
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
590
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
591
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
592
|
+
#
|
593
|
+
# @overload moderate_text(document: nil)
|
594
|
+
# Pass arguments to `moderate_text` via keyword arguments. Note that at
|
595
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
596
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
597
|
+
#
|
598
|
+
# @param document [::Google::Cloud::Language::V1beta2::Document, ::Hash]
|
599
|
+
# Required. Input document.
|
600
|
+
#
|
601
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
602
|
+
# @yieldparam response [::Google::Cloud::Language::V1beta2::ModerateTextResponse]
|
603
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
604
|
+
#
|
605
|
+
# @return [::Google::Cloud::Language::V1beta2::ModerateTextResponse]
|
606
|
+
#
|
607
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
608
|
+
#
|
609
|
+
# @example Basic example
|
610
|
+
# require "google/cloud/language/v1beta2"
|
611
|
+
#
|
612
|
+
# # Create a client object. The client can be reused for multiple calls.
|
613
|
+
# client = Google::Cloud::Language::V1beta2::LanguageService::Client.new
|
614
|
+
#
|
615
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
616
|
+
# request = Google::Cloud::Language::V1beta2::ModerateTextRequest.new
|
617
|
+
#
|
618
|
+
# # Call the moderate_text method.
|
619
|
+
# result = client.moderate_text request
|
620
|
+
#
|
621
|
+
# # The returned object is of type Google::Cloud::Language::V1beta2::ModerateTextResponse.
|
622
|
+
# p result
|
623
|
+
#
|
624
|
+
def moderate_text request, options = nil
|
625
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
626
|
+
|
627
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1beta2::ModerateTextRequest
|
628
|
+
|
629
|
+
# Converts hash and nil to an options object
|
630
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
631
|
+
|
632
|
+
# Customize the options with defaults
|
633
|
+
metadata = @config.rpcs.moderate_text.metadata.to_h
|
634
|
+
|
635
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
636
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
637
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
638
|
+
gapic_version: ::Google::Cloud::Language::V1beta2::VERSION
|
639
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
640
|
+
|
641
|
+
options.apply_defaults timeout: @config.rpcs.moderate_text.timeout,
|
642
|
+
metadata: metadata,
|
643
|
+
retry_policy: @config.rpcs.moderate_text.retry_policy
|
644
|
+
|
645
|
+
options.apply_defaults timeout: @config.timeout,
|
646
|
+
metadata: @config.metadata,
|
647
|
+
retry_policy: @config.retry_policy
|
648
|
+
|
649
|
+
@language_service_stub.call_rpc :moderate_text, request, options: options do |response, operation|
|
650
|
+
yield response, operation if block_given?
|
651
|
+
return response
|
652
|
+
end
|
653
|
+
rescue ::GRPC::BadStatus => e
|
654
|
+
raise ::Google::Cloud::Error.from_error(e)
|
655
|
+
end
|
656
|
+
|
578
657
|
##
|
579
658
|
# A convenience method that provides all syntax, sentiment, entity, and
|
580
659
|
# classification features in one call.
|
@@ -695,9 +774,9 @@ module Google
|
|
695
774
|
# * (`String`) The path to a service account key file in JSON format
|
696
775
|
# * (`Hash`) A service account key as a Hash
|
697
776
|
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
698
|
-
# (see the [googleauth docs](https://
|
777
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
699
778
|
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
700
|
-
# (see the [signet docs](https://
|
779
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
701
780
|
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
702
781
|
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
703
782
|
# * (`nil`) indicating no credentials
|
@@ -818,6 +897,11 @@ module Google
|
|
818
897
|
#
|
819
898
|
attr_reader :classify_text
|
820
899
|
##
|
900
|
+
# RPC-specific configuration for `moderate_text`
|
901
|
+
# @return [::Gapic::Config::Method]
|
902
|
+
#
|
903
|
+
attr_reader :moderate_text
|
904
|
+
##
|
821
905
|
# RPC-specific configuration for `annotate_text`
|
822
906
|
# @return [::Gapic::Config::Method]
|
823
907
|
#
|
@@ -835,6 +919,8 @@ module Google
|
|
835
919
|
@analyze_syntax = ::Gapic::Config::Method.new analyze_syntax_config
|
836
920
|
classify_text_config = parent_rpcs.classify_text if parent_rpcs.respond_to? :classify_text
|
837
921
|
@classify_text = ::Gapic::Config::Method.new classify_text_config
|
922
|
+
moderate_text_config = parent_rpcs.moderate_text if parent_rpcs.respond_to? :moderate_text
|
923
|
+
@moderate_text = ::Gapic::Config::Method.new moderate_text_config
|
838
924
|
annotate_text_config = parent_rpcs.annotate_text if parent_rpcs.respond_to? :annotate_text
|
839
925
|
@annotate_text = ::Gapic::Config::Method.new annotate_text_config
|
840
926
|
|