Cloud Natural Language V2 Client - Class EntityMention (0.31.3)

Reference documentation and code samples for the Cloud Natural Language V2 Client class EntityMention.

Represents a mention for an entity in the text. Currently, proper noun mentions are supported.

Generated from protobuf message google.cloud.language.v2.EntityMention

Namespace

Google \ Cloud \ Language \ V2

Methods

__construct

Constructor.

Parameters
NameDescription
data array

Optional. Data for populating the Message object.

↳ text Google\Cloud\Language\V2\TextSpan

The mention text.

↳ type int

The type of the entity mention.

↳ sentiment Google\Cloud\Language\V2\Sentiment

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

↳ probability float

Probability score associated with the entity. The score shows the probability of the entity mention being the entity type. The score is in (0, 1] range.

getText

The mention text.

Returns
TypeDescription
Google\Cloud\Language\V2\TextSpan|null

hasText

clearText

setText

The mention text.

Parameter
NameDescription
var Google\Cloud\Language\V2\TextSpan
Returns
TypeDescription
$this

getType

The type of the entity mention.

Returns
TypeDescription
int

setType

The type of the entity mention.

Parameter
NameDescription
var int
Returns
TypeDescription
$this

getSentiment

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

Returns
TypeDescription
Google\Cloud\Language\V2\Sentiment|null

hasSentiment

clearSentiment

setSentiment

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

Parameter
NameDescription
var Google\Cloud\Language\V2\Sentiment
Returns
TypeDescription
$this

getProbability

Probability score associated with the entity.

The score shows the probability of the entity mention being the entity type. The score is in (0, 1] range.

Returns
TypeDescription
float

setProbability

Probability score associated with the entity.

The score shows the probability of the entity mention being the entity type. The score is in (0, 1] range.

Parameter
NameDescription
var float
Returns
TypeDescription
$this