Class: Google::Apis::LanguageV1beta1::CloudNaturalLanguageAPIService

Inherits:
Core::BaseService
  • Object
show all
Defined in:
generated/google/apis/language_v1beta1/service.rb

Overview

Google Cloud Natural Language API

Google Cloud Natural Language API provides natural language understanding technologies to developers. Examples include sentiment analysis, entity recognition, and text annotations.

Examples:

require 'google/apis/language_v1beta1'

Language = Google::Apis::LanguageV1beta1 # Alias the module
service = Language::CloudNaturalLanguageAPIService.new

See Also:

Instance Attribute Summary collapse

Attributes inherited from Core::BaseService

#authorization, #base_path, #batch_path, #client, #client_options, #request_options, #root_url, #upload_path

Instance Method Summary collapse

Methods inherited from Core::BaseService

#batch, #batch_upload, #fetch_all, #http

Constructor Details

#initializeCloudNaturalLanguageAPIService

Returns a new instance of CloudNaturalLanguageAPIService.



47
48
49
# File 'generated/google/apis/language_v1beta1/service.rb', line 47

def initialize
  super('https://language.googleapis.com/', '')
end

Instance Attribute Details

#keyString

Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

Returns:

  • (String)

    API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.



40
41
42
# File 'generated/google/apis/language_v1beta1/service.rb', line 40

def key
  @key
end

#quota_userString

Returns Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

Returns:

  • (String)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.



45
46
47
# File 'generated/google/apis/language_v1beta1/service.rb', line 45

def quota_user
  @quota_user
end

Instance Method Details

#analyze_document_entities(analyze_entities_request_object = nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LanguageV1beta1::AnalyzeEntitiesResponse

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

Parameters:

  • analyze_entities_request_object (Google::Apis::LanguageV1beta1::AnalyzeEntitiesRequest) (defaults to: nil)
  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



132
133
134
135
136
137
138
139
140
141
# File 'generated/google/apis/language_v1beta1/service.rb', line 132

def analyze_document_entities(analyze_entities_request_object = nil, quota_user: nil, fields: nil, options: nil, &block)
  command =  make_simple_command(:post, 'v1beta1/documents:analyzeEntities', options)
  command.request_representation = Google::Apis::LanguageV1beta1::AnalyzeEntitiesRequest::Representation
  command.request_object = analyze_entities_request_object
  command.response_representation = Google::Apis::LanguageV1beta1::AnalyzeEntitiesResponse::Representation
  command.response_class = Google::Apis::LanguageV1beta1::AnalyzeEntitiesResponse
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['fields'] = fields unless fields.nil?
  execute_or_queue_command(command, &block)
end

#analyze_document_sentiment(analyze_sentiment_request_object = nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LanguageV1beta1::AnalyzeSentimentResponse

Analyzes the sentiment of the provided text.

Parameters:

  • analyze_sentiment_request_object (Google::Apis::LanguageV1beta1::AnalyzeSentimentRequest) (defaults to: nil)
  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



70
71
72
73
74
75
76
77
78
79
# File 'generated/google/apis/language_v1beta1/service.rb', line 70

def analyze_document_sentiment(analyze_sentiment_request_object = nil, quota_user: nil, fields: nil, options: nil, &block)
  command =  make_simple_command(:post, 'v1beta1/documents:analyzeSentiment', options)
  command.request_representation = Google::Apis::LanguageV1beta1::AnalyzeSentimentRequest::Representation
  command.request_object = analyze_sentiment_request_object
  command.response_representation = Google::Apis::LanguageV1beta1::AnalyzeSentimentResponse::Representation
  command.response_class = Google::Apis::LanguageV1beta1::AnalyzeSentimentResponse
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['fields'] = fields unless fields.nil?
  execute_or_queue_command(command, &block)
end

#annotate_document_text(annotate_text_request_object = nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LanguageV1beta1::AnnotateTextResponse

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

Parameters:

  • annotate_text_request_object (Google::Apis::LanguageV1beta1::AnnotateTextRequest) (defaults to: nil)
  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



101
102
103
104
105
106
107
108
109
110
# File 'generated/google/apis/language_v1beta1/service.rb', line 101

def annotate_document_text(annotate_text_request_object = nil, quota_user: nil, fields: nil, options: nil, &block)
  command =  make_simple_command(:post, 'v1beta1/documents:annotateText', options)
  command.request_representation = Google::Apis::LanguageV1beta1::AnnotateTextRequest::Representation
  command.request_object = annotate_text_request_object
  command.response_representation = Google::Apis::LanguageV1beta1::AnnotateTextResponse::Representation
  command.response_class = Google::Apis::LanguageV1beta1::AnnotateTextResponse
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['fields'] = fields unless fields.nil?
  execute_or_queue_command(command, &block)
end