Reference documentation and code samples for the Cloud Natural Language V2 Client class 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.
Generated from protobuf messagegoogle.cloud.language.v2.Entity
For calls toAnalyzeEntitySentimentor ifAnnotateTextRequest.Features.extract_entity_sentimentis set to true, this field will contain the aggregate sentiment expressed for this entity in the provided document.
getName
The representative name for the entity.
Returns
Type
Description
string
setName
The representative name for the entity.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getType
The entity type.
Returns
Type
Description
int
setType
The entity type.
Parameter
Name
Description
var
int
Returns
Type
Description
$this
getMetadata
Metadata associated with the entity.
For the metadata
associated with other entity types, see the Type table below.
For calls toAnalyzeEntitySentimentor ifAnnotateTextRequest.Features.extract_entity_sentimentis set to true, this field will contain the aggregate sentiment expressed
for this entity in the provided document.
For calls toAnalyzeEntitySentimentor ifAnnotateTextRequest.Features.extract_entity_sentimentis 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 Client - Class Entity (1.0.1)\n\nVersion latestkeyboard_arrow_down\n\n- [1.0.1 (latest)](/php/docs/reference/cloud-language/latest/V2.Entity)\n- [1.0.0](/php/docs/reference/cloud-language/1.0.0/V2.Entity)\n- [0.34.3](/php/docs/reference/cloud-language/0.34.3/V2.Entity)\n- [0.33.0](/php/docs/reference/cloud-language/0.33.0/V2.Entity)\n- [0.32.7](/php/docs/reference/cloud-language/0.32.7/V2.Entity)\n- [0.31.3](/php/docs/reference/cloud-language/0.31.3/V2.Entity)\n- [0.30.2](/php/docs/reference/cloud-language/0.30.2/V2.Entity)\n- [0.29.0](/php/docs/reference/cloud-language/0.29.0/V2.Entity)\n- [0.28.5](/php/docs/reference/cloud-language/0.28.5/V2.Entity) \nReference documentation and code samples for the Cloud Natural Language V2 Client class 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\nGenerated from protobuf message `google.cloud.language.v2.Entity`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Language \\\\ V2\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getName\n\nThe representative name for the entity.\n\n### setName\n\nThe representative name for the entity.\n\n### getType\n\nThe entity type.\n\n### setType\n\nThe entity type.\n\n### getMetadata\n\nMetadata associated with the entity.\n\nFor the metadata\nassociated with other entity types, see the Type table below.\n\n### setMetadata\n\nMetadata associated with the entity.\n\nFor the metadata\nassociated with other entity types, see the Type table below.\n\n### getMentions\n\nThe mentions of this entity in the input document. The API currently\nsupports proper noun mentions.\n\n### setMentions\n\nThe mentions of this entity in the input document. The API currently\nsupports proper noun mentions.\n\n### getSentiment\n\nFor calls to AnalyzeEntitySentiment or if\nAnnotateTextRequest.Features.extract_entity_sentiment\nis set to true, this field will contain the aggregate sentiment expressed\nfor this entity in the provided document.\n\n### hasSentiment\n\n### clearSentiment\n\n### setSentiment\n\nFor calls to AnalyzeEntitySentiment or if\nAnnotateTextRequest.Features.extract_entity_sentiment\nis set to true, this field will contain the aggregate sentiment expressed\nfor this entity in the provided document."]]