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.



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

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



593
594
595
# File 'lib/google/apis/language_v2/classes.rb', line 593

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>)


599
600
601
# File 'lib/google/apis/language_v2/classes.rb', line 599

def 
  @metadata
end

#nameString

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

Returns:

  • (String)


604
605
606
# File 'lib/google/apis/language_v2/classes.rb', line 604

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



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

def sentiment
  @sentiment
end

#typeString

The entity type. Corresponds to the JSON property type

Returns:

  • (String)


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

def type
  @type
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



621
622
623
624
625
626
627
# File 'lib/google/apis/language_v2/classes.rb', line 621

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