Class: Google::Cloud::Language::V1::Entity

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/language/v1/doc/google/cloud/language/v1/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

Instance Attribute Summary collapse

Instance Attribute Details

#mentionsArray<Google::Cloud::Language::V1::EntityMention>

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

Returns:



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
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
# File 'lib/google/cloud/language/v1/doc/google/cloud/language/v1/language_service.rb', line 106

class Entity
  # 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<br><br>
    # The metadata lists the phone number, formatted according to local
    # convention, plus whichever additional elements appear in the text:<ul>
    # <li><code>number</code> &ndash; the actual number, broken down into
    # sections as per local convention</li> <li><code>national_prefix</code>
    # &ndash; country code, if detected</li> <li><code>area_code</code> &ndash;
    # region or area code, if detected</li> <li><code>extension</code> &ndash;
    # phone extension (to be dialed after connection), if detected</li></ul>
    PHONE_NUMBER = 9

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

    # Date<br><br>
    # The metadata identifies the components of the date:<ul>
    # <li><code>year</code> &ndash; four digit year, if detected</li>
    # <li><code>month</code> &ndash; two digit month number, if detected</li>
    # <li><code>day</code> &ndash; two digit day number, if detected</li></ul>
    DATE = 11

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

    # Price<br><br>
    # The metadata identifies the <code>value</code> and <code>currency</code>.
    PRICE = 13
  end
end

#metadataHash{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:

  • (Hash{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.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
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
# File 'lib/google/cloud/language/v1/doc/google/cloud/language/v1/language_service.rb', line 106

class Entity
  # 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<br><br>
    # The metadata lists the phone number, formatted according to local
    # convention, plus whichever additional elements appear in the text:<ul>
    # <li><code>number</code> &ndash; the actual number, broken down into
    # sections as per local convention</li> <li><code>national_prefix</code>
    # &ndash; country code, if detected</li> <li><code>area_code</code> &ndash;
    # region or area code, if detected</li> <li><code>extension</code> &ndash;
    # phone extension (to be dialed after connection), if detected</li></ul>
    PHONE_NUMBER = 9

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

    # Date<br><br>
    # The metadata identifies the components of the date:<ul>
    # <li><code>year</code> &ndash; four digit year, if detected</li>
    # <li><code>month</code> &ndash; two digit month number, if detected</li>
    # <li><code>day</code> &ndash; two digit day number, if detected</li></ul>
    DATE = 11

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

    # Price<br><br>
    # The metadata identifies the <code>value</code> and <code>currency</code>.
    PRICE = 13
  end
end

#nameString

Returns The representative name for the entity.

Returns:

  • (String)

    The representative name for the entity.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
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
# File 'lib/google/cloud/language/v1/doc/google/cloud/language/v1/language_service.rb', line 106

class Entity
  # 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<br><br>
    # The metadata lists the phone number, formatted according to local
    # convention, plus whichever additional elements appear in the text:<ul>
    # <li><code>number</code> &ndash; the actual number, broken down into
    # sections as per local convention</li> <li><code>national_prefix</code>
    # &ndash; country code, if detected</li> <li><code>area_code</code> &ndash;
    # region or area code, if detected</li> <li><code>extension</code> &ndash;
    # phone extension (to be dialed after connection), if detected</li></ul>
    PHONE_NUMBER = 9

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

    # Date<br><br>
    # The metadata identifies the components of the date:<ul>
    # <li><code>year</code> &ndash; four digit year, if detected</li>
    # <li><code>month</code> &ndash; two digit month number, if detected</li>
    # <li><code>day</code> &ndash; two digit day number, if detected</li></ul>
    DATE = 11

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

    # Price<br><br>
    # The metadata identifies the <code>value</code> and <code>currency</code>.
    PRICE = 13
  end
end

#salienceFloat

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.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
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
# File 'lib/google/cloud/language/v1/doc/google/cloud/language/v1/language_service.rb', line 106

class Entity
  # 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<br><br>
    # The metadata lists the phone number, formatted according to local
    # convention, plus whichever additional elements appear in the text:<ul>
    # <li><code>number</code> &ndash; the actual number, broken down into
    # sections as per local convention</li> <li><code>national_prefix</code>
    # &ndash; country code, if detected</li> <li><code>area_code</code> &ndash;
    # region or area code, if detected</li> <li><code>extension</code> &ndash;
    # phone extension (to be dialed after connection), if detected</li></ul>
    PHONE_NUMBER = 9

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

    # Date<br><br>
    # The metadata identifies the components of the date:<ul>
    # <li><code>year</code> &ndash; four digit year, if detected</li>
    # <li><code>month</code> &ndash; two digit month number, if detected</li>
    # <li><code>day</code> &ndash; two digit day number, if detected</li></ul>
    DATE = 11

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

    # Price<br><br>
    # The metadata identifies the <code>value</code> and <code>currency</code>.
    PRICE = 13
  end
end

#sentimentGoogle::Cloud::Language::V1::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:



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
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
# File 'lib/google/cloud/language/v1/doc/google/cloud/language/v1/language_service.rb', line 106

class Entity
  # 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<br><br>
    # The metadata lists the phone number, formatted according to local
    # convention, plus whichever additional elements appear in the text:<ul>
    # <li><code>number</code> &ndash; the actual number, broken down into
    # sections as per local convention</li> <li><code>national_prefix</code>
    # &ndash; country code, if detected</li> <li><code>area_code</code> &ndash;
    # region or area code, if detected</li> <li><code>extension</code> &ndash;
    # phone extension (to be dialed after connection), if detected</li></ul>
    PHONE_NUMBER = 9

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

    # Date<br><br>
    # The metadata identifies the components of the date:<ul>
    # <li><code>year</code> &ndash; four digit year, if detected</li>
    # <li><code>month</code> &ndash; two digit month number, if detected</li>
    # <li><code>day</code> &ndash; two digit day number, if detected</li></ul>
    DATE = 11

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

    # Price<br><br>
    # The metadata identifies the <code>value</code> and <code>currency</code>.
    PRICE = 13
  end
end

#typeGoogle::Cloud::Language::V1::Entity::Type

Returns The entity type.

Returns:



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
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
# File 'lib/google/cloud/language/v1/doc/google/cloud/language/v1/language_service.rb', line 106

class Entity
  # 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<br><br>
    # The metadata lists the phone number, formatted according to local
    # convention, plus whichever additional elements appear in the text:<ul>
    # <li><code>number</code> &ndash; the actual number, broken down into
    # sections as per local convention</li> <li><code>national_prefix</code>
    # &ndash; country code, if detected</li> <li><code>area_code</code> &ndash;
    # region or area code, if detected</li> <li><code>extension</code> &ndash;
    # phone extension (to be dialed after connection), if detected</li></ul>
    PHONE_NUMBER = 9

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

    # Date<br><br>
    # The metadata identifies the components of the date:<ul>
    # <li><code>year</code> &ndash; four digit year, if detected</li>
    # <li><code>month</code> &ndash; two digit month number, if detected</li>
    # <li><code>day</code> &ndash; two digit day number, if detected</li></ul>
    DATE = 11

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

    # Price<br><br>
    # The metadata identifies the <code>value</code> and <code>currency</code>.
    PRICE = 13
  end
end