Class: Google::Apis::LanguageV2::Entity

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

Represents a phrase in the text that is a known entity, such as a person, an organization, or location. The API associates information, such as probability and mentions, with entities.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ Entity

Returns a new instance of Entity.



409
410
411
# File 'lib/google/apis/language_v2/classes.rb', line 409

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

Instance Attribute Details

#mentions ⇒ Array<Google::Apis::LanguageV2::EntityMention>

The mentions of this entity in the input document. The API currently supports proper noun mentions. Corresponds to the JSON property mentions



384
385
386
# File 'lib/google/apis/language_v2/classes.rb', line 384

def mentions
  @mentions
end

#metadata ⇒ Hash<String,String>

Metadata associated with the entity. For most entity types, the metadata is a Wikipedia URL (wikipedia_url) and Knowledge Graph MID (mid), if they are available. For the metadata associated with other entity types, see the Type table below. Corresponds to the JSON property metadata

Returns:

  • (Hash<String,String>)


392
393
394
# File 'lib/google/apis/language_v2/classes.rb', line 392

def 
  @metadata
end

#name ⇒ String

The representative name for the entity. Corresponds to the JSON property name

Returns:

  • (String)


397
398
399
# File 'lib/google/apis/language_v2/classes.rb', line 397

def name
  @name
end

#sentiment ⇒ Google::Apis::LanguageV2::Sentiment

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



402
403
404
# File 'lib/google/apis/language_v2/classes.rb', line 402

def sentiment
  @sentiment
end

#type ⇒ String

The entity type. Corresponds to the JSON property type

Returns:

  • (String)


407
408
409
# File 'lib/google/apis/language_v2/classes.rb', line 407

def type
  @type
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



414
415
416
417
418
419
420
# File 'lib/google/apis/language_v2/classes.rb', line 414

def update!(**args)
  @mentions = args[:mentions] if args.key?(:mentions)
  @metadata = args[:metadata] if args.key?(:metadata)
  @name = args[:name] if args.key?(:name)
  @sentiment = args[:sentiment] if args.key?(:sentiment)
  @type = args[:type] if args.key?(:type)
end