Class: Google::Apis::LanguageV2::EntityMention

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 mention for an entity in the text. Currently, proper noun mentions are supported.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ EntityMention

Returns a new instance of EntityMention.



447
448
449
# File 'lib/google/apis/language_v2/classes.rb', line 447

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

Instance Attribute Details

#probability ⇒ Float

Probability score associated with the entity. The score shows the probability of the entity mention being the entity type. The score is in (0, 1] range. Corresponds to the JSON property probability

Returns:

  • (Float)


430
431
432
# File 'lib/google/apis/language_v2/classes.rb', line 430

def probability
  @probability
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



435
436
437
# File 'lib/google/apis/language_v2/classes.rb', line 435

def sentiment
  @sentiment
end

#text ⇒ Google::Apis::LanguageV2::TextSpan

Represents a text span in the input document. Corresponds to the JSON property text



440
441
442
# File 'lib/google/apis/language_v2/classes.rb', line 440

def text
  @text
end

#type ⇒ String

The type of the entity mention. Corresponds to the JSON property type

Returns:

  • (String)


445
446
447
# File 'lib/google/apis/language_v2/classes.rb', line 445

def type
  @type
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



452
453
454
455
456
457
# File 'lib/google/apis/language_v2/classes.rb', line 452

def update!(**args)
  @probability = args[:probability] if args.key?(:probability)
  @sentiment = args[:sentiment] if args.key?(:sentiment)
  @text = args[:text] if args.key?(:text)
  @type = args[:type] if args.key?(:type)
end