Natural Language V1 API - Class Google::Cloud::Language::V1::LanguageService::Rest::Client (v0.7.0)

Reference documentation and code samples for the Natural Language V1 API class Google::Cloud::Language::V1::LanguageService::Rest::Client.

REST client for the LanguageService service.

Provides text analysis operations such as sentiment analysis and entity recognition.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the LanguageService Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all LanguageService clients
::Google::Cloud::Language::V1::LanguageService::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#analyze_entities

def analyze_entities(request, options = nil) -> ::Google::Cloud::Language::V1::AnalyzeEntitiesResponse
def analyze_entities(document: nil, encoding_type: nil) -> ::Google::Cloud::Language::V1::AnalyzeEntitiesResponse

Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for each entity, and other properties.

Overloads
def analyze_entities(request, options = nil) -> ::Google::Cloud::Language::V1::AnalyzeEntitiesResponse
Pass arguments to analyze_entities via a request object, either of type AnalyzeEntitiesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Language::V1::AnalyzeEntitiesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def analyze_entities(document: nil, encoding_type: nil) -> ::Google::Cloud::Language::V1::AnalyzeEntitiesResponse
Pass arguments to analyze_entities via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#analyze_entity_sentiment

def analyze_entity_sentiment(request, options = nil) -> ::Google::Cloud::Language::V1::AnalyzeEntitySentimentResponse
def analyze_entity_sentiment(document: nil, encoding_type: nil) -> ::Google::Cloud::Language::V1::AnalyzeEntitySentimentResponse

Finds entities, similar to AnalyzeEntities in the text and analyzes sentiment associated with each entity and its mentions.

Overloads
def analyze_entity_sentiment(request, options = nil) -> ::Google::Cloud::Language::V1::AnalyzeEntitySentimentResponse
Pass arguments to analyze_entity_sentiment via a request object, either of type AnalyzeEntitySentimentRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Language::V1::AnalyzeEntitySentimentRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def analyze_entity_sentiment(document: nil, encoding_type: nil) -> ::Google::Cloud::Language::V1::AnalyzeEntitySentimentResponse
Pass arguments to analyze_entity_sentiment via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#analyze_sentiment

def analyze_sentiment(request, options = nil) -> ::Google::Cloud::Language::V1::AnalyzeSentimentResponse
def analyze_sentiment(document: nil, encoding_type: nil) -> ::Google::Cloud::Language::V1::AnalyzeSentimentResponse

Analyzes the sentiment of the provided text.

Overloads
def analyze_sentiment(request, options = nil) -> ::Google::Cloud::Language::V1::AnalyzeSentimentResponse
Pass arguments to analyze_sentiment via a request object, either of type AnalyzeSentimentRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Language::V1::AnalyzeSentimentRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def analyze_sentiment(document: nil, encoding_type: nil) -> ::Google::Cloud::Language::V1::AnalyzeSentimentResponse
Pass arguments to analyze_sentiment via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#analyze_syntax

def analyze_syntax(request, options = nil) -> ::Google::Cloud::Language::V1::AnalyzeSyntaxResponse
def analyze_syntax(document: nil, encoding_type: nil) -> ::Google::Cloud::Language::V1::AnalyzeSyntaxResponse

Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties.

Overloads
def analyze_syntax(request, options = nil) -> ::Google::Cloud::Language::V1::AnalyzeSyntaxResponse
Pass arguments to analyze_syntax via a request object, either of type AnalyzeSyntaxRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Language::V1::AnalyzeSyntaxRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def analyze_syntax(document: nil, encoding_type: nil) -> ::Google::Cloud::Language::V1::AnalyzeSyntaxResponse
Pass arguments to analyze_syntax via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#annotate_text

def annotate_text(request, options = nil) -> ::Google::Cloud::Language::V1::AnnotateTextResponse
def annotate_text(document: nil, features: nil, encoding_type: nil) -> ::Google::Cloud::Language::V1::AnnotateTextResponse

A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and analyzeSyntax provide in one call.

Overloads
def annotate_text(request, options = nil) -> ::Google::Cloud::Language::V1::AnnotateTextResponse
Pass arguments to annotate_text via a request object, either of type AnnotateTextRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Language::V1::AnnotateTextRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def annotate_text(document: nil, features: nil, encoding_type: nil) -> ::Google::Cloud::Language::V1::AnnotateTextResponse
Pass arguments to annotate_text via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#classify_text

def classify_text(request, options = nil) -> ::Google::Cloud::Language::V1::ClassifyTextResponse
def classify_text(document: nil, classification_model_options: nil) -> ::Google::Cloud::Language::V1::ClassifyTextResponse

Classifies a document into categories.

Overloads
def classify_text(request, options = nil) -> ::Google::Cloud::Language::V1::ClassifyTextResponse
Pass arguments to classify_text via a request object, either of type ClassifyTextRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Language::V1::ClassifyTextRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def classify_text(document: nil, classification_model_options: nil) -> ::Google::Cloud::Language::V1::ClassifyTextResponse
Pass arguments to classify_text via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the LanguageService Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#initialize

def initialize() { |config| ... } -> Client

Create a new LanguageService REST client object.

Yields
  • (config) — Configure the LanguageService client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::Language::V1::LanguageService::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Language::V1::LanguageService::Rest::Client.new do |config|
  config.timeout = 10.0
end