Cloud Natural Language V1beta2 Client - Class Sentiment (0.29.0)

Reference documentation and code samples for the Cloud Natural Language V1beta2 Client class Sentiment.

Represents the feeling associated with the entire text or entities in the text.

Next ID: 6

Generated from protobuf message google.cloud.language.v1beta2.Sentiment

Methods

__construct

Constructor.

Parameters
NameDescription
data array

Optional. Data for populating the Message object.

↳ magnitude float

A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative).

↳ score float

Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).

getMagnitude

A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative).

Returns
TypeDescription
float

setMagnitude

A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative).

Parameter
NameDescription
var float
Returns
TypeDescription
$this

getScore

Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).

Returns
TypeDescription
float

setScore

Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).

Parameter
NameDescription
var float
Returns
TypeDescription
$this