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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54edb9b0db12a1443da0bdbaefc899d151ea1f4d62ee48739ddccb2028472c01
4
- data.tar.gz: c64d9f82f2936a70d140cecf3baba4d855763566fa731a1e240b47d0f47192ae
3
+ metadata.gz: f97b1bd17892d0675f958d4f101cf1a19e29c76e9e0e894cda907a05d2e3fa7c
4
+ data.tar.gz: 3784d4dc0d0ae8c5bad2b096018afe29c6a6aa861a3b015be46bc464358dd660
5
5
  SHA512:
6
- metadata.gz: 70a0015537cc76fedbf5568a4df22197b5c78b3b5ad19322ddbe84a0e6f058649eef41274a1351e160573bbc4c6d4dbec11bebf9dbec0fc798a30c546eda26d2
7
- data.tar.gz: 83c1ea529ab771c558beed222cd7a5336a75a142df43e455166ecc2f869399e1b9356485d5411a23730ec5a0c9bf6d296c9f39a315bfacf811c235435bbaa568
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
- API Client library for the Natural Language V1beta2 API
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/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
50
- or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
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 {::Google::Cloud::Language::V1beta2::LanguageService::Client#analyze_entities AnalyzeEntities} in the text and analyzes
339
- # sentiment associated with each entity and its mentions.
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://googleapis.dev/ruby/googleauth/latest/index.html))
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://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
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