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.



231
232
233
# File 'lib/google/apis/language_v2/classes.rb', line 231

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

Instance Attribute Details

#categories ⇒ Array<Google::Apis::LanguageV2::ClassificationCategory>

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



191
192
193
# File 'lib/google/apis/language_v2/classes.rb', line 191

def categories
  @categories
end

#document_sentiment ⇒ Google::Apis::LanguageV2::Sentiment

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



196
197
198
# File 'lib/google/apis/language_v2/classes.rb', line 196

def document_sentiment
  @document_sentiment
end

#entities ⇒ Array<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



203
204
205
# File 'lib/google/apis/language_v2/classes.rb', line 203

def entities
  @entities
end

#language_code ⇒ String

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)


210
211
212
# File 'lib/google/apis/language_v2/classes.rb', line 210

def language_code
  @language_code
end

#language_supported ⇒ Boolean 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)


217
218
219
# File 'lib/google/apis/language_v2/classes.rb', line 217

def language_supported
  @language_supported
end

#moderation_categories ⇒ Array<Google::Apis::LanguageV2::ClassificationCategory>

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



223
224
225
# File 'lib/google/apis/language_v2/classes.rb', line 223

def moderation_categories
  @moderation_categories
end

#sentences ⇒ Array<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



229
230
231
# File 'lib/google/apis/language_v2/classes.rb', line 229

def sentences
  @sentences
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



236
237
238
239
240
241
242
243
244
# File 'lib/google/apis/language_v2/classes.rb', line 236

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