Class: Google::Apis::LanguageV1::Entity

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
generated/google/apis/language_v1/classes.rb,
generated/google/apis/language_v1/representations.rb,
generated/google/apis/language_v1/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 salience and mentions, with entities.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Core::JsonObjectSupport

#to_json

Methods included from Core::Hashable

process_value, #to_h

Constructor Details

#initialize(**args) ⇒ Entity

Returns a new instance of Entity



459
460
461
# File 'generated/google/apis/language_v1/classes.rb', line 459

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

Instance Attribute Details

#mentionsArray<Google::Apis::LanguageV1::EntityMention>

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



425
426
427
# File 'generated/google/apis/language_v1/classes.rb', line 425

def mentions
  @mentions
end

#metadataHash<String,String>

Metadata associated with the entity. Currently, Wikipedia URLs and Knowledge Graph MIDs are provided, if available. The associated keys are "wikipedia_url" and "mid", respectively. Corresponds to the JSON property metadata

Returns:

  • (Hash<String,String>)


432
433
434
# File 'generated/google/apis/language_v1/classes.rb', line 432

def 
  @metadata
end

#nameString

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

Returns:

  • (String)


437
438
439
# File 'generated/google/apis/language_v1/classes.rb', line 437

def name
  @name
end

#salienceFloat

The salience score associated with the entity in the [0, 1.0] range. The salience score for an entity provides information about the importance or centrality of that entity to the entire document text. Scores closer to 0 are less salient, while scores closer to 1.0 are highly salient. Corresponds to the JSON property salience

Returns:

  • (Float)


446
447
448
# File 'generated/google/apis/language_v1/classes.rb', line 446

def salience
  @salience
end

#sentimentGoogle::Apis::LanguageV1::Sentiment

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



452
453
454
# File 'generated/google/apis/language_v1/classes.rb', line 452

def sentiment
  @sentiment
end

#typeString

The entity type. Corresponds to the JSON property type

Returns:

  • (String)


457
458
459
# File 'generated/google/apis/language_v1/classes.rb', line 457

def type
  @type
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



464
465
466
467
468
469
470
471
# File 'generated/google/apis/language_v1/classes.rb', line 464

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