Cloud Natural Language V2 Client - Class Sentence (0.34.1)

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

Represents a sentence in the input document.

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

Namespace

Google \ Cloud \ Language \ V2

Methods

__construct

Constructor.

Parameters
Name Description
data array

Optional. Data for populating the Message object.

↳ text TextSpan

The sentence text.

↳ sentiment Sentiment

For calls to AnalyzeSentiment or if AnnotateTextRequest.Features.extract_document_sentiment is set to true, this field will contain the sentiment for the sentence.

getText

The sentence text.

Returns
Type Description
TextSpan|null

hasText

clearText

setText

The sentence text.

Parameter
Name Description
var TextSpan
Returns
Type Description
$this

getSentiment

For calls to AnalyzeSentiment or if AnnotateTextRequest.Features.extract_document_sentiment is set to true, this field will contain the sentiment for the sentence.

Returns
Type Description
Sentiment|null

hasSentiment

clearSentiment

setSentiment

For calls to AnalyzeSentiment or if AnnotateTextRequest.Features.extract_document_sentiment is set to true, this field will contain the sentiment for the sentence.

Parameter
Name Description
var Sentiment
Returns
Type Description
$this