Class: Google::Apis::LanguageV2::AnnotateTextResponse

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
lib/google/apis/language_v2/classes.rb,
lib/google/apis/language_v2/representations.rb,
lib/google/apis/language_v2/representations.rb

Overview

The text annotations response message.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ AnnotateTextResponse

Returns a new instance of AnnotateTextResponse.



273
274
275
# File 'lib/google/apis/language_v2/classes.rb', line 273

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#categoriesArray<Google::Apis::LanguageV2::ClassificationCategory>

Categories identified in the input document. Corresponds to the JSON property categories



233
234
235
# File 'lib/google/apis/language_v2/classes.rb', line 233

def categories
  @categories
end

#document_sentimentGoogle::Apis::LanguageV2::Sentiment

Represents the feeling associated with the entire text or entities in the text. Corresponds to the JSON property documentSentiment



238
239
240
# File 'lib/google/apis/language_v2/classes.rb', line 238

def document_sentiment
  @document_sentiment
end

#entitiesArray<Google::Apis::LanguageV2::Entity>

Entities, along with their semantic information, in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_entities or AnnotateTextRequest.Features.extract_entity_sentiment. Corresponds to the JSON property entities



245
246
247
# File 'lib/google/apis/language_v2/classes.rb', line 245

def entities
  @entities
end

#language_codeString

The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See Document.language field for more details. Corresponds to the JSON property languageCode

Returns:

  • (String)


252
253
254
# File 'lib/google/apis/language_v2/classes.rb', line 252

def language_code
  @language_code
end

#language_supportedBoolean Also known as: language_supported?

Whether the language is officially supported by all requested features. The API may still return a response when the language is not supported, but it is on a best effort basis. Corresponds to the JSON property languageSupported

Returns:

  • (Boolean)


259
260
261
# File 'lib/google/apis/language_v2/classes.rb', line 259

def language_supported
  @language_supported
end

#moderation_categoriesArray<Google::Apis::LanguageV2::ClassificationCategory>

Harmful and sensitive categories identified in the input document. Corresponds to the JSON property moderationCategories



265
266
267
# File 'lib/google/apis/language_v2/classes.rb', line 265

def moderation_categories
  @moderation_categories
end

#sentencesArray<Google::Apis::LanguageV2::Sentence>

Sentences in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_document_sentiment. Corresponds to the JSON property sentences



271
272
273
# File 'lib/google/apis/language_v2/classes.rb', line 271

def sentences
  @sentences
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



278
279
280
281
282
283
284
285
286
# File 'lib/google/apis/language_v2/classes.rb', line 278

def update!(**args)
  @categories = args[:categories] if args.key?(:categories)
  @document_sentiment = args[:document_sentiment] if args.key?(:document_sentiment)
  @entities = args[:entities] if args.key?(:entities)
  @language_code = args[:language_code] if args.key?(:language_code)
  @language_supported = args[:language_supported] if args.key?(:language_supported)
  @moderation_categories = args[:moderation_categories] if args.key?(:moderation_categories)
  @sentences = args[:sentences] if args.key?(:sentences)
end