google-cloud-language-v1 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: 9adc4f1cd6b86c6aba8ebd140d79a2b5bf7c37e2bc068ab09efeded8e3223b4e
4
- data.tar.gz: c72eb057130398c019db8eacaca7760bd6c248a9d11cc1f05db6fe7b838f6df5
3
+ metadata.gz: 57b3621633efdcf5ed36ae27fa2c760b8d9eef4a80cf5673d987eef5bae262f3
4
+ data.tar.gz: b5a70cc8b6a46cf0d2b4755217fa3132245a4c8316c68f580b39bba423f963ec
5
5
  SHA512:
6
- metadata.gz: b21eaec60cef78aa3cc57cd0e1615e5d9528a7f0c03edad486b2c053ed2e9baa5def3ce1beef465efc79e3fbdf16c517b356f84c5a4468651463938d2d9cca3c
7
- data.tar.gz: 88f86e47b58d76ab57f5250a032c9a6ab124ec373279f4cea6d98d9c0050d2df54c2e33bfa1c5dd28290842b8e385075f538f8ef388b48b378035ff1851b441c
6
+ metadata.gz: c5cca96d308085f9653821e4293a4e64f8fa502bc5530321a8b801eabb034612e20926faeb5e0d81f5b62fd19546699577898b50e8270048063b9a3ff6091ce5
7
+ data.tar.gz: 1cb0ae3259d58e2eb469a0f25a7887eeef778656a970d8699ad7fd4b5167ff9fce8f72712c0768b0032d7919aa8da3feb1e4541060420dc931997e342dd7bd90
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ruby Client for the Natural Language V1 API
2
2
 
3
- API Client library for the Natural Language V1 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
 
@@ -334,8 +334,10 @@ module Google
334
334
  end
335
335
 
336
336
  ##
337
- # Finds entities, similar to {::Google::Cloud::Language::V1::LanguageService::Client#analyze_entities AnalyzeEntities} in the text and analyzes
338
- # sentiment associated with each entity and its mentions.
337
+ # Finds entities, similar to
338
+ # {::Google::Cloud::Language::V1::LanguageService::Client#analyze_entities AnalyzeEntities}
339
+ # in the text and analyzes sentiment associated with each entity and its
340
+ # mentions.
339
341
  #
340
342
  # @overload analyze_entity_sentiment(request, options = nil)
341
343
  # Pass arguments to `analyze_entity_sentiment` via a request object, either of type
@@ -574,6 +576,83 @@ module Google
574
576
  raise ::Google::Cloud::Error.from_error(e)
575
577
  end
576
578
 
579
+ ##
580
+ # Moderates a document for harmful and sensitive categories.
581
+ #
582
+ # @overload moderate_text(request, options = nil)
583
+ # Pass arguments to `moderate_text` via a request object, either of type
584
+ # {::Google::Cloud::Language::V1::ModerateTextRequest} or an equivalent Hash.
585
+ #
586
+ # @param request [::Google::Cloud::Language::V1::ModerateTextRequest, ::Hash]
587
+ # A request object representing the call parameters. Required. To specify no
588
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
589
+ # @param options [::Gapic::CallOptions, ::Hash]
590
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
591
+ #
592
+ # @overload moderate_text(document: nil)
593
+ # Pass arguments to `moderate_text` via keyword arguments. Note that at
594
+ # least one keyword argument is required. To specify no parameters, or to keep all
595
+ # the default parameter values, pass an empty Hash as a request object (see above).
596
+ #
597
+ # @param document [::Google::Cloud::Language::V1::Document, ::Hash]
598
+ # Required. Input document.
599
+ #
600
+ # @yield [response, operation] Access the result along with the RPC operation
601
+ # @yieldparam response [::Google::Cloud::Language::V1::ModerateTextResponse]
602
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
603
+ #
604
+ # @return [::Google::Cloud::Language::V1::ModerateTextResponse]
605
+ #
606
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
607
+ #
608
+ # @example Basic example
609
+ # require "google/cloud/language/v1"
610
+ #
611
+ # # Create a client object. The client can be reused for multiple calls.
612
+ # client = Google::Cloud::Language::V1::LanguageService::Client.new
613
+ #
614
+ # # Create a request. To set request fields, pass in keyword arguments.
615
+ # request = Google::Cloud::Language::V1::ModerateTextRequest.new
616
+ #
617
+ # # Call the moderate_text method.
618
+ # result = client.moderate_text request
619
+ #
620
+ # # The returned object is of type Google::Cloud::Language::V1::ModerateTextResponse.
621
+ # p result
622
+ #
623
+ def moderate_text request, options = nil
624
+ raise ::ArgumentError, "request must be provided" if request.nil?
625
+
626
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1::ModerateTextRequest
627
+
628
+ # Converts hash and nil to an options object
629
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
630
+
631
+ # Customize the options with defaults
632
+ metadata = @config.rpcs.moderate_text.metadata.to_h
633
+
634
+ # Set x-goog-api-client and x-goog-user-project headers
635
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
636
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
637
+ gapic_version: ::Google::Cloud::Language::V1::VERSION
638
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
639
+
640
+ options.apply_defaults timeout: @config.rpcs.moderate_text.timeout,
641
+ metadata: metadata,
642
+ retry_policy: @config.rpcs.moderate_text.retry_policy
643
+
644
+ options.apply_defaults timeout: @config.timeout,
645
+ metadata: @config.metadata,
646
+ retry_policy: @config.retry_policy
647
+
648
+ @language_service_stub.call_rpc :moderate_text, request, options: options do |response, operation|
649
+ yield response, operation if block_given?
650
+ return response
651
+ end
652
+ rescue ::GRPC::BadStatus => e
653
+ raise ::Google::Cloud::Error.from_error(e)
654
+ end
655
+
577
656
  ##
578
657
  # A convenience method that provides all the features that analyzeSentiment,
579
658
  # analyzeEntities, and analyzeSyntax provide in one call.
@@ -694,9 +773,9 @@ module Google
694
773
  # * (`String`) The path to a service account key file in JSON format
695
774
  # * (`Hash`) A service account key as a Hash
696
775
  # * (`Google::Auth::Credentials`) A googleauth credentials object
697
- # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
776
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
698
777
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
699
- # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
778
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
700
779
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
701
780
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
702
781
  # * (`nil`) indicating no credentials
@@ -817,6 +896,11 @@ module Google
817
896
  #
818
897
  attr_reader :classify_text
819
898
  ##
899
+ # RPC-specific configuration for `moderate_text`
900
+ # @return [::Gapic::Config::Method]
901
+ #
902
+ attr_reader :moderate_text
903
+ ##
820
904
  # RPC-specific configuration for `annotate_text`
821
905
  # @return [::Gapic::Config::Method]
822
906
  #
@@ -834,6 +918,8 @@ module Google
834
918
  @analyze_syntax = ::Gapic::Config::Method.new analyze_syntax_config
835
919
  classify_text_config = parent_rpcs.classify_text if parent_rpcs.respond_to? :classify_text
836
920
  @classify_text = ::Gapic::Config::Method.new classify_text_config
921
+ moderate_text_config = parent_rpcs.moderate_text if parent_rpcs.respond_to? :moderate_text
922
+ @moderate_text = ::Gapic::Config::Method.new moderate_text_config
837
923
  annotate_text_config = parent_rpcs.annotate_text if parent_rpcs.respond_to? :annotate_text
838
924
  @annotate_text = ::Gapic::Config::Method.new annotate_text_config
839
925