Reference documentation and code samples for the Natural Language V1beta2 API class Google::Cloud::Language::V1beta2::Entity.
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.
(::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.
value (::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.
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.
#name
defname()->::String
Returns
(::String) — The representative name for the entity.
#name=
defname=(value)->::String
Parameter
value (::String) — The representative name for the entity.
Returns
(::String) — The representative name for the entity.
#salience
defsalience()->::Float
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.
#salience=
defsalience=(value)->::Float
Parameter
value (::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.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-09 UTC."],[],[],null,["# Natural Language V1beta2 API - Class Google::Cloud::Language::V1beta2::Entity (v0.14.0)\n\nVersion latestkeyboard_arrow_down\n\n- [0.14.0 (latest)](/ruby/docs/reference/google-cloud-language-v1beta2/latest/Google-Cloud-Language-V1beta2-Entity)\n- [0.13.1](/ruby/docs/reference/google-cloud-language-v1beta2/0.13.1/Google-Cloud-Language-V1beta2-Entity)\n- [0.12.0](/ruby/docs/reference/google-cloud-language-v1beta2/0.12.0/Google-Cloud-Language-V1beta2-Entity)\n- [0.11.1](/ruby/docs/reference/google-cloud-language-v1beta2/0.11.1/Google-Cloud-Language-V1beta2-Entity)\n- [0.10.2](/ruby/docs/reference/google-cloud-language-v1beta2/0.10.2/Google-Cloud-Language-V1beta2-Entity)\n- [0.9.0](/ruby/docs/reference/google-cloud-language-v1beta2/0.9.0/Google-Cloud-Language-V1beta2-Entity)\n- [0.8.1](/ruby/docs/reference/google-cloud-language-v1beta2/0.8.1/Google-Cloud-Language-V1beta2-Entity)\n- [0.7.0](/ruby/docs/reference/google-cloud-language-v1beta2/0.7.0/Google-Cloud-Language-V1beta2-Entity)\n- [0.6.0](/ruby/docs/reference/google-cloud-language-v1beta2/0.6.0/Google-Cloud-Language-V1beta2-Entity)\n- [0.5.0](/ruby/docs/reference/google-cloud-language-v1beta2/0.5.0/Google-Cloud-Language-V1beta2-Entity)\n- [0.4.5](/ruby/docs/reference/google-cloud-language-v1beta2/0.4.5/Google-Cloud-Language-V1beta2-Entity) \nReference documentation and code samples for the Natural Language V1beta2 API class Google::Cloud::Language::V1beta2::Entity.\n\nRepresents a phrase in the text that is a known entity, such as\na person, an organization, or location. The API associates information, such\nas salience and mentions, with entities. \n\nInherits\n--------\n\n- Object \n\nExtended By\n-----------\n\n- Google::Protobuf::MessageExts::ClassMethods \n\nIncludes\n--------\n\n- Google::Protobuf::MessageExts\n\nMethods\n-------\n\n### #mentions\n\n def mentions() -\u003e ::Array\u003c::Google::Cloud::Language::V1beta2::EntityMention\u003e\n\n**Returns**\n\n- (::Array\\\u003c[::Google::Cloud::Language::V1beta2::EntityMention](./Google-Cloud-Language-V1beta2-EntityMention)\\\u003e) --- The mentions of this entity in the input document. The API currently supports proper noun mentions.\n\n### #mentions=\n\n def mentions=(value) -\u003e ::Array\u003c::Google::Cloud::Language::V1beta2::EntityMention\u003e\n\n**Parameter**\n\n- **value** (::Array\\\u003c[::Google::Cloud::Language::V1beta2::EntityMention](./Google-Cloud-Language-V1beta2-EntityMention)\\\u003e) --- The mentions of this entity in the input document. The API currently supports proper noun mentions. \n**Returns**\n\n- (::Array\\\u003c[::Google::Cloud::Language::V1beta2::EntityMention](./Google-Cloud-Language-V1beta2-EntityMention)\\\u003e) --- The mentions of this entity in the input document. The API currently supports proper noun mentions.\n\n### #metadata\n\n def metadata() -\u003e ::Google::Protobuf::Map{::String =\u003e ::String}\n\n**Returns**\n\n- (::Google::Protobuf::Map{::String =\\\u003e ::String}) --- Metadata associated with the entity.\n\n For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`)\n and Knowledge Graph MID (`mid`), if they are available. For the metadata\n associated with other entity types, see the Type table below.\n\n### #metadata=\n\n def metadata=(value) -\u003e ::Google::Protobuf::Map{::String =\u003e ::String}\n\n**Parameter**\n\n- **value** (::Google::Protobuf::Map{::String =\\\u003e ::String}) --- Metadata associated with the entity.\n\n\n For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`)\n and Knowledge Graph MID (`mid`), if they are available. For the metadata\nassociated with other entity types, see the Type table below. \n**Returns**\n\n- (::Google::Protobuf::Map{::String =\\\u003e ::String}) --- Metadata associated with the entity.\n\n For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`)\n and Knowledge Graph MID (`mid`), if they are available. For the metadata\n associated with other entity types, see the Type table below.\n\n### #name\n\n def name() -\u003e ::String\n\n**Returns**\n\n- (::String) --- The representative name for the entity.\n\n### #name=\n\n def name=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- The representative name for the entity. \n**Returns**\n\n- (::String) --- The representative name for the entity.\n\n### #salience\n\n def salience() -\u003e ::Float\n\n**Returns**\n\n- (::Float) --- The salience score associated with the entity in the \\[0, 1.0\\] range.\n\n The salience score for an entity provides information about the\n importance or centrality of that entity to the entire document text.\n Scores closer to 0 are less salient, while scores closer to 1.0 are highly\n salient.\n\n### #salience=\n\n def salience=(value) -\u003e ::Float\n\n**Parameter**\n\n- **value** (::Float) --- The salience score associated with the entity in the \\[0, 1.0\\] range.\n\n\n The salience score for an entity provides information about the\n importance or centrality of that entity to the entire document text.\n Scores closer to 0 are less salient, while scores closer to 1.0 are highly\nsalient. \n**Returns**\n\n- (::Float) --- The salience score associated with the entity in the \\[0, 1.0\\] range.\n\n The salience score for an entity provides information about the\n importance or centrality of that entity to the entire document text.\n Scores closer to 0 are less salient, while scores closer to 1.0 are highly\n salient.\n\n### #sentiment\n\n def sentiment() -\u003e ::Google::Cloud::Language::V1beta2::Sentiment\n\n**Returns**\n\n- ([::Google::Cloud::Language::V1beta2::Sentiment](./Google-Cloud-Language-V1beta2-Sentiment)) --- For calls to \\[AnalyzeEntitySentiment\\]\\[\\] or if [AnnotateTextRequest.Features.extract_entity_sentiment](/ruby/docs/reference/google-cloud-language-v1beta2/latest/Google-Cloud-Language-V1beta2-AnnotateTextRequest-Features#Google__Cloud__Language__V1beta2__AnnotateTextRequest__Features_extract_entity_sentiment_instance_ \"Google::Cloud::Language::V1beta2::AnnotateTextRequest::Features#extract_entity_sentiment (method)\") is set to true, this field will contain the aggregate sentiment expressed for this entity in the provided document.\n\n### #sentiment=\n\n def sentiment=(value) -\u003e ::Google::Cloud::Language::V1beta2::Sentiment\n\n**Parameter**\n\n- **value** ([::Google::Cloud::Language::V1beta2::Sentiment](./Google-Cloud-Language-V1beta2-Sentiment)) --- For calls to \\[AnalyzeEntitySentiment\\]\\[\\] or if [AnnotateTextRequest.Features.extract_entity_sentiment](/ruby/docs/reference/google-cloud-language-v1beta2/latest/Google-Cloud-Language-V1beta2-AnnotateTextRequest-Features#Google__Cloud__Language__V1beta2__AnnotateTextRequest__Features_extract_entity_sentiment_instance_ \"Google::Cloud::Language::V1beta2::AnnotateTextRequest::Features#extract_entity_sentiment (method)\") is set to true, this field will contain the aggregate sentiment expressed for this entity in the provided document. \n**Returns**\n\n- ([::Google::Cloud::Language::V1beta2::Sentiment](./Google-Cloud-Language-V1beta2-Sentiment)) --- For calls to \\[AnalyzeEntitySentiment\\]\\[\\] or if [AnnotateTextRequest.Features.extract_entity_sentiment](/ruby/docs/reference/google-cloud-language-v1beta2/latest/Google-Cloud-Language-V1beta2-AnnotateTextRequest-Features#Google__Cloud__Language__V1beta2__AnnotateTextRequest__Features_extract_entity_sentiment_instance_ \"Google::Cloud::Language::V1beta2::AnnotateTextRequest::Features#extract_entity_sentiment (method)\") is set to true, this field will contain the aggregate sentiment expressed for this entity in the provided document.\n\n### #type\n\n def type() -\u003e ::Google::Cloud::Language::V1beta2::Entity::Type\n\n**Returns**\n\n- ([::Google::Cloud::Language::V1beta2::Entity::Type](./Google-Cloud-Language-V1beta2-Entity-Type)) --- The entity type.\n\n### #type=\n\n def type=(value) -\u003e ::Google::Cloud::Language::V1beta2::Entity::Type\n\n**Parameter**\n\n- **value** ([::Google::Cloud::Language::V1beta2::Entity::Type](./Google-Cloud-Language-V1beta2-Entity-Type)) --- The entity type. \n**Returns**\n\n- ([::Google::Cloud::Language::V1beta2::Entity::Type](./Google-Cloud-Language-V1beta2-Entity-Type)) --- The entity type."]]