Class: Google::Cloud::Language::V1beta2::Entity

Inherits:
Object
  • Object
show all
Extended by:
Protobuf::MessageExts::ClassMethods
Includes:
Protobuf::MessageExts
Defined in:
proto_docs/google/cloud/language/v1beta2/language_service.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.

Defined Under Namespace

Modules: Type Classes: MetadataEntry

Instance Attribute Summary collapse

Instance Attribute Details

#mentions::Array<::Google::Cloud::Language::V1beta2::EntityMention>

Returns The mentions of this entity in the input document. The API currently supports proper noun mentions.

Returns:



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'proto_docs/google/cloud/language/v1beta2/language_service.rb', line 136

class Entity
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::String]
  class MetadataEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The type of the entity. For most entity types, the associated metadata is a
  # Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`). The table
  # below lists the associated fields for entities that have different
  # metadata.
  module Type
    # Unknown
    UNKNOWN = 0

    # Person
    PERSON = 1

    # Location
    LOCATION = 2

    # Organization
    ORGANIZATION = 3

    # Event
    EVENT = 4

    # Artwork
    WORK_OF_ART = 5

    # Consumer product
    CONSUMER_GOOD = 6

    # Other types of entities
    OTHER = 7

    # Phone number
    #
    # The metadata lists the phone number, formatted according to local
    # convention, plus whichever additional elements appear in the text:
    #
    # * `number` - the actual number, broken down into sections as per local
    # convention
    # * `national_prefix` - country code, if detected
    # * `area_code` - region or area code, if detected
    # * `extension` - phone extension (to be dialed after connection), if
    # detected
    PHONE_NUMBER = 9

    # Address
    #
    # The metadata identifies the street number and locality plus whichever
    # additional elements appear in the text:
    #
    # * `street_number` - street number
    # * `locality` - city or town
    # * `street_name` - street/route name, if detected
    # * `postal_code` - postal code, if detected
    # * `country` - country, if detected<
    # * `broad_region` - administrative area, such as the state, if detected
    # * `narrow_region` - smaller administrative area, such as county, if
    # detected
    # * `sublocality` - used in Asian addresses to demark a district within a
    # city, if detected
    ADDRESS = 10

    # Date
    #
    # The metadata identifies the components of the date:
    #
    # * `year` - four digit year, if detected
    # * `month` - two digit month number, if detected
    # * `day` - two digit day number, if detected
    DATE = 11

    # Number
    #
    # The metadata is the number itself.
    NUMBER = 12

    # Price
    #
    # The metadata identifies the `value` and `currency`.
    PRICE = 13
  end
end

#metadata::Google::Protobuf::Map{::String => ::String}

Returns 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.

Returns:

  • (::Google::Protobuf::Map{::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.



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'proto_docs/google/cloud/language/v1beta2/language_service.rb', line 136

class Entity
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::String]
  class MetadataEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The type of the entity. For most entity types, the associated metadata is a
  # Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`). The table
  # below lists the associated fields for entities that have different
  # metadata.
  module Type
    # Unknown
    UNKNOWN = 0

    # Person
    PERSON = 1

    # Location
    LOCATION = 2

    # Organization
    ORGANIZATION = 3

    # Event
    EVENT = 4

    # Artwork
    WORK_OF_ART = 5

    # Consumer product
    CONSUMER_GOOD = 6

    # Other types of entities
    OTHER = 7

    # Phone number
    #
    # The metadata lists the phone number, formatted according to local
    # convention, plus whichever additional elements appear in the text:
    #
    # * `number` - the actual number, broken down into sections as per local
    # convention
    # * `national_prefix` - country code, if detected
    # * `area_code` - region or area code, if detected
    # * `extension` - phone extension (to be dialed after connection), if
    # detected
    PHONE_NUMBER = 9

    # Address
    #
    # The metadata identifies the street number and locality plus whichever
    # additional elements appear in the text:
    #
    # * `street_number` - street number
    # * `locality` - city or town
    # * `street_name` - street/route name, if detected
    # * `postal_code` - postal code, if detected
    # * `country` - country, if detected<
    # * `broad_region` - administrative area, such as the state, if detected
    # * `narrow_region` - smaller administrative area, such as county, if
    # detected
    # * `sublocality` - used in Asian addresses to demark a district within a
    # city, if detected
    ADDRESS = 10

    # Date
    #
    # The metadata identifies the components of the date:
    #
    # * `year` - four digit year, if detected
    # * `month` - two digit month number, if detected
    # * `day` - two digit day number, if detected
    DATE = 11

    # Number
    #
    # The metadata is the number itself.
    NUMBER = 12

    # Price
    #
    # The metadata identifies the `value` and `currency`.
    PRICE = 13
  end
end

#name::String

Returns The representative name for the entity.

Returns:

  • (::String)

    The representative name for the entity.



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'proto_docs/google/cloud/language/v1beta2/language_service.rb', line 136

class Entity
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::String]
  class MetadataEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The type of the entity. For most entity types, the associated metadata is a
  # Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`). The table
  # below lists the associated fields for entities that have different
  # metadata.
  module Type
    # Unknown
    UNKNOWN = 0

    # Person
    PERSON = 1

    # Location
    LOCATION = 2

    # Organization
    ORGANIZATION = 3

    # Event
    EVENT = 4

    # Artwork
    WORK_OF_ART = 5

    # Consumer product
    CONSUMER_GOOD = 6

    # Other types of entities
    OTHER = 7

    # Phone number
    #
    # The metadata lists the phone number, formatted according to local
    # convention, plus whichever additional elements appear in the text:
    #
    # * `number` - the actual number, broken down into sections as per local
    # convention
    # * `national_prefix` - country code, if detected
    # * `area_code` - region or area code, if detected
    # * `extension` - phone extension (to be dialed after connection), if
    # detected
    PHONE_NUMBER = 9

    # Address
    #
    # The metadata identifies the street number and locality plus whichever
    # additional elements appear in the text:
    #
    # * `street_number` - street number
    # * `locality` - city or town
    # * `street_name` - street/route name, if detected
    # * `postal_code` - postal code, if detected
    # * `country` - country, if detected<
    # * `broad_region` - administrative area, such as the state, if detected
    # * `narrow_region` - smaller administrative area, such as county, if
    # detected
    # * `sublocality` - used in Asian addresses to demark a district within a
    # city, if detected
    ADDRESS = 10

    # Date
    #
    # The metadata identifies the components of the date:
    #
    # * `year` - four digit year, if detected
    # * `month` - two digit month number, if detected
    # * `day` - two digit day number, if detected
    DATE = 11

    # Number
    #
    # The metadata is the number itself.
    NUMBER = 12

    # Price
    #
    # The metadata identifies the `value` and `currency`.
    PRICE = 13
  end
end

#salience::Float

Returns 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.

Returns:

  • (::Float)

    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.



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'proto_docs/google/cloud/language/v1beta2/language_service.rb', line 136

class Entity
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::String]
  class MetadataEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The type of the entity. For most entity types, the associated metadata is a
  # Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`). The table
  # below lists the associated fields for entities that have different
  # metadata.
  module Type
    # Unknown
    UNKNOWN = 0

    # Person
    PERSON = 1

    # Location
    LOCATION = 2

    # Organization
    ORGANIZATION = 3

    # Event
    EVENT = 4

    # Artwork
    WORK_OF_ART = 5

    # Consumer product
    CONSUMER_GOOD = 6

    # Other types of entities
    OTHER = 7

    # Phone number
    #
    # The metadata lists the phone number, formatted according to local
    # convention, plus whichever additional elements appear in the text:
    #
    # * `number` - the actual number, broken down into sections as per local
    # convention
    # * `national_prefix` - country code, if detected
    # * `area_code` - region or area code, if detected
    # * `extension` - phone extension (to be dialed after connection), if
    # detected
    PHONE_NUMBER = 9

    # Address
    #
    # The metadata identifies the street number and locality plus whichever
    # additional elements appear in the text:
    #
    # * `street_number` - street number
    # * `locality` - city or town
    # * `street_name` - street/route name, if detected
    # * `postal_code` - postal code, if detected
    # * `country` - country, if detected<
    # * `broad_region` - administrative area, such as the state, if detected
    # * `narrow_region` - smaller administrative area, such as county, if
    # detected
    # * `sublocality` - used in Asian addresses to demark a district within a
    # city, if detected
    ADDRESS = 10

    # Date
    #
    # The metadata identifies the components of the date:
    #
    # * `year` - four digit year, if detected
    # * `month` - two digit month number, if detected
    # * `day` - two digit day number, if detected
    DATE = 11

    # Number
    #
    # The metadata is the number itself.
    NUMBER = 12

    # Price
    #
    # The metadata identifies the `value` and `currency`.
    PRICE = 13
  end
end

#sentiment::Google::Cloud::Language::V1beta2::Sentiment

Returns For calls to [AnalyzeEntitySentiment][] or if AnnotateTextRequest.Features.extract_entity_sentiment is set to true, this field will contain the aggregate sentiment expressed for this entity in the provided document.

Returns:



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'proto_docs/google/cloud/language/v1beta2/language_service.rb', line 136

class Entity
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::String]
  class MetadataEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The type of the entity. For most entity types, the associated metadata is a
  # Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`). The table
  # below lists the associated fields for entities that have different
  # metadata.
  module Type
    # Unknown
    UNKNOWN = 0

    # Person
    PERSON = 1

    # Location
    LOCATION = 2

    # Organization
    ORGANIZATION = 3

    # Event
    EVENT = 4

    # Artwork
    WORK_OF_ART = 5

    # Consumer product
    CONSUMER_GOOD = 6

    # Other types of entities
    OTHER = 7

    # Phone number
    #
    # The metadata lists the phone number, formatted according to local
    # convention, plus whichever additional elements appear in the text:
    #
    # * `number` - the actual number, broken down into sections as per local
    # convention
    # * `national_prefix` - country code, if detected
    # * `area_code` - region or area code, if detected
    # * `extension` - phone extension (to be dialed after connection), if
    # detected
    PHONE_NUMBER = 9

    # Address
    #
    # The metadata identifies the street number and locality plus whichever
    # additional elements appear in the text:
    #
    # * `street_number` - street number
    # * `locality` - city or town
    # * `street_name` - street/route name, if detected
    # * `postal_code` - postal code, if detected
    # * `country` - country, if detected<
    # * `broad_region` - administrative area, such as the state, if detected
    # * `narrow_region` - smaller administrative area, such as county, if
    # detected
    # * `sublocality` - used in Asian addresses to demark a district within a
    # city, if detected
    ADDRESS = 10

    # Date
    #
    # The metadata identifies the components of the date:
    #
    # * `year` - four digit year, if detected
    # * `month` - two digit month number, if detected
    # * `day` - two digit day number, if detected
    DATE = 11

    # Number
    #
    # The metadata is the number itself.
    NUMBER = 12

    # Price
    #
    # The metadata identifies the `value` and `currency`.
    PRICE = 13
  end
end

#type::Google::Cloud::Language::V1beta2::Entity::Type

Returns The entity type.

Returns:



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'proto_docs/google/cloud/language/v1beta2/language_service.rb', line 136

class Entity
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::String]
  class MetadataEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The type of the entity. For most entity types, the associated metadata is a
  # Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`). The table
  # below lists the associated fields for entities that have different
  # metadata.
  module Type
    # Unknown
    UNKNOWN = 0

    # Person
    PERSON = 1

    # Location
    LOCATION = 2

    # Organization
    ORGANIZATION = 3

    # Event
    EVENT = 4

    # Artwork
    WORK_OF_ART = 5

    # Consumer product
    CONSUMER_GOOD = 6

    # Other types of entities
    OTHER = 7

    # Phone number
    #
    # The metadata lists the phone number, formatted according to local
    # convention, plus whichever additional elements appear in the text:
    #
    # * `number` - the actual number, broken down into sections as per local
    # convention
    # * `national_prefix` - country code, if detected
    # * `area_code` - region or area code, if detected
    # * `extension` - phone extension (to be dialed after connection), if
    # detected
    PHONE_NUMBER = 9

    # Address
    #
    # The metadata identifies the street number and locality plus whichever
    # additional elements appear in the text:
    #
    # * `street_number` - street number
    # * `locality` - city or town
    # * `street_name` - street/route name, if detected
    # * `postal_code` - postal code, if detected
    # * `country` - country, if detected<
    # * `broad_region` - administrative area, such as the state, if detected
    # * `narrow_region` - smaller administrative area, such as county, if
    # detected
    # * `sublocality` - used in Asian addresses to demark a district within a
    # city, if detected
    ADDRESS = 10

    # Date
    #
    # The metadata identifies the components of the date:
    #
    # * `year` - four digit year, if detected
    # * `month` - two digit month number, if detected
    # * `day` - two digit day number, if detected
    DATE = 11

    # Number
    #
    # The metadata is the number itself.
    NUMBER = 12

    # Price
    #
    # The metadata identifies the `value` and `currency`.
    PRICE = 13
  end
end