Reference documentation and code samples for the Cloud Natural Language V2 API class Google::Cloud::Language::V2::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 probability and mentions, with entities.
(::Google::Cloud::Language::V2::Sentiment) — For calls to [AnalyzeEntitySentiment][] or if
[AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v2.AnnotateTextRequest.Features.extract_entity_sentiment]
is set to true, this field will contain the aggregate sentiment expressed
for this entity in the provided document.
value (::Google::Cloud::Language::V2::Sentiment) — For calls to [AnalyzeEntitySentiment][] or if
[AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v2.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
(::Google::Cloud::Language::V2::Sentiment) — For calls to [AnalyzeEntitySentiment][] or if
[AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v2.AnnotateTextRequest.Features.extract_entity_sentiment]
is set to true, this field will contain the aggregate sentiment expressed
for this entity in the provided document.
[[["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-04 UTC."],[],[],null,["# Cloud Natural Language V2 API - Class Google::Cloud::Language::V2::Entity (v1.1.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.1.0 (latest)](/ruby/docs/reference/google-cloud-language-v2/latest/Google-Cloud-Language-V2-Entity)\n- [1.0.1](/ruby/docs/reference/google-cloud-language-v2/1.0.1/Google-Cloud-Language-V2-Entity)\n- [0.7.0](/ruby/docs/reference/google-cloud-language-v2/0.7.0/Google-Cloud-Language-V2-Entity)\n- [0.6.0](/ruby/docs/reference/google-cloud-language-v2/0.6.0/Google-Cloud-Language-V2-Entity)\n- [0.5.1](/ruby/docs/reference/google-cloud-language-v2/0.5.1/Google-Cloud-Language-V2-Entity)\n- [0.4.0](/ruby/docs/reference/google-cloud-language-v2/0.4.0/Google-Cloud-Language-V2-Entity)\n- [0.3.2](/ruby/docs/reference/google-cloud-language-v2/0.3.2/Google-Cloud-Language-V2-Entity)\n- [0.2.0](/ruby/docs/reference/google-cloud-language-v2/0.2.0/Google-Cloud-Language-V2-Entity)\n- [0.1.0](/ruby/docs/reference/google-cloud-language-v2/0.1.0/Google-Cloud-Language-V2-Entity) \nReference documentation and code samples for the Cloud Natural Language V2 API class Google::Cloud::Language::V2::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 probability 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::V2::EntityMention\u003e\n\n**Returns**\n\n- (::Array\\\u003c[::Google::Cloud::Language::V2::EntityMention](./Google-Cloud-Language-V2-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::V2::EntityMention\u003e\n\n**Parameter**\n\n- **value** (::Array\\\u003c[::Google::Cloud::Language::V2::EntityMention](./Google-Cloud-Language-V2-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::V2::EntityMention](./Google-Cloud-Language-V2-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 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 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 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### #sentiment\n\n def sentiment() -\u003e ::Google::Cloud::Language::V2::Sentiment\n\n**Returns**\n\n- ([::Google::Cloud::Language::V2::Sentiment](./Google-Cloud-Language-V2-Sentiment)) --- For calls to \\[AnalyzeEntitySentiment\\]\\[\\] or if \\[AnnotateTextRequest.Features.extract_entity_sentiment\\]\\[google.cloud.language.v2.AnnotateTextRequest.Features.extract_entity_sentiment\\] 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::V2::Sentiment\n\n**Parameter**\n\n- **value** ([::Google::Cloud::Language::V2::Sentiment](./Google-Cloud-Language-V2-Sentiment)) --- For calls to \\[AnalyzeEntitySentiment\\]\\[\\] or if \\[AnnotateTextRequest.Features.extract_entity_sentiment\\]\\[google.cloud.language.v2.AnnotateTextRequest.Features.extract_entity_sentiment\\] 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::V2::Sentiment](./Google-Cloud-Language-V2-Sentiment)) --- For calls to \\[AnalyzeEntitySentiment\\]\\[\\] or if \\[AnnotateTextRequest.Features.extract_entity_sentiment\\]\\[google.cloud.language.v2.AnnotateTextRequest.Features.extract_entity_sentiment\\] 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::V2::Entity::Type\n\n**Returns**\n\n- ([::Google::Cloud::Language::V2::Entity::Type](./Google-Cloud-Language-V2-Entity-Type)) --- The entity type.\n\n### #type=\n\n def type=(value) -\u003e ::Google::Cloud::Language::V2::Entity::Type\n\n**Parameter**\n\n- **value** ([::Google::Cloud::Language::V2::Entity::Type](./Google-Cloud-Language-V2-Entity-Type)) --- The entity type. \n**Returns**\n\n- ([::Google::Cloud::Language::V2::Entity::Type](./Google-Cloud-Language-V2-Entity-Type)) --- The entity type."]]