# ITextSplitterService

Namespace: **Wisej.AI.Services**

Assembly: **Wisej.AI** (3.5.0.0)

Represents a service for splitting text into an array of substrings.

{% tabs %}
{% tab title="C#" %}

```csharp
public interface ITextSplitterService
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Interface ITextSplitterService
```

{% endtab %}
{% endtabs %}

This interface defines a contract for text splitting services. The primary function is to take a single piece of text and split it into an array of substrings based on a specific implementation-defined criterion.\
Implementations of this interface may use different strategies for splitting, such as splitting by spaces, punctuation, or custom delimiters.

## Methods

### ![](/files/ptrKjmmRoQB76pvrIqh0) Split(text)

Splits the specified text into an array of substrings.

| Parameter | Type                                                          | Description                                                                    |
| --------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to split into substrings. This parameter should not be null or empty. |

**Returns:** [String\[\]](https://docs.microsoft.com/dotnet/api/system.string). An array of substrings derived from the *text* .

This method processes the input text according to the splitting logic defined by the implementation. The result is an array where each element is a substring of the original text.\
Example usage:

```csharp

  ITextSplitterService splitterService = new SimpleTextSplitterService();
  string[] words = splitterService.Split("This is a sample text.");
  // words: ["This", "is", "a", "sample", "text."]

```

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when the *text* is null.

## Implemented By

| Name                                                                                                                                                 | Description                                                                                                                                                                                                        |
| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [RecursiveCharacterTextSplitterService](/ai/components/api/services/itextsplitterservice/wisej.ai.services.recursivecharactertextsplitterservice.md) | A service for recursively splitting text into chunks based on specified separators and chunk size constraints. This service attempts to split text by different characters to find an optimal separation strategy. |
| [TextSplitterServiceBase](/ai/components/api/services/itextsplitterservice/wisej.ai.services.textsplitterservicebase.md)                             | Provides the base functionality for text splitting services, allowing subclasses to define custom splitting logic.                                                                                                 |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/ai/components/api/services/itextsplitterservice.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
