# Cloud Natural Language V2 Client - Class Sentiment (1.2.1)

1.2.1 (latest) 1.2.0 1.1.4 1.0.1 0.34.3 0.33.0 0.32.7 0.31.3 0.30.2 0.29.0 0.28.5 Reference documentation and code samples for the Cloud Natural Language V2 Client class Sentiment.

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

Generated from protobuf message `google.cloud.language.v2.Sentiment`

## Namespace

Google \\ Cloud \\ Language \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `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** ||
|---|---|
| **Type** | **Description** |
| `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** ||
|---|---|
| **Name** | **Description** |
| `var` | `float` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getScore

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

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `float` |   |

### setScore

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

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `float` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |