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.



608
609
610
# File 'lib/google/apis/language_v2/classes.rb', line 608

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

Instance Attribute Details

#mentionsArray<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



585
586
587
# File 'lib/google/apis/language_v2/classes.rb', line 585

def mentions
  @mentions
end

#metadataHash<String,String>

Metadata associated with the entity. For the metadata associated with other entity types, see the Type table below. Corresponds to the JSON property metadata

Returns:

  • (Hash<String,String>)


591
592
593
# File 'lib/google/apis/language_v2/classes.rb', line 591

def 
  @metadata
end

#nameString

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

Returns:

  • (String)


596
597
598
# File 'lib/google/apis/language_v2/classes.rb', line 596

def name
  @name
end

#sentimentGoogle::Apis::LanguageV2::Sentiment

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



601
602
603
# File 'lib/google/apis/language_v2/classes.rb', line 601

def sentiment
  @sentiment
end

#typeString

The entity type. Corresponds to the JSON property type

Returns:

  • (String)


606
607
608
# File 'lib/google/apis/language_v2/classes.rb', line 606

def type
  @type
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



613
614
615
616
617
618
619
# File 'lib/google/apis/language_v2/classes.rb', line 613

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