# Cloud Natural Language V2 Client - Class TextSpan (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 TextSpan.

Represents a text span in the input document.

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

## Namespace

Google \\ Cloud \\ Language \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ content` | `string` The content of the text span, which is a substring of the document. |
| `↳ begin_offset` | `int` The API calculates the beginning offset of the content in the original document according to the [EncodingType](https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.EncodingType) specified in the API request. |

### getContent

The content of the text span, which is a substring of the document.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setContent

The content of the text span, which is a substring of the document.

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

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

### getBeginOffset

The API calculates the beginning offset of the content in the original
document according to the
[EncodingType](https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.EncodingType) specified in the API
request.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setBeginOffset

The API calculates the beginning offset of the content in the original
document according to the
[EncodingType](https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.EncodingType) specified in the API
request.

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

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