TextSplitter
Split a text string into a list of strings.
We're working on adding pipeline examples and most common component connections.
Key Features
- Accepts a text string as input and splits it into a list of strings.
Configuration
- Drag the
TextSplittercomponent onto the canvas from the Component Library. - Click on the component to open the configuration panel.
- On the General tab, no configuration is required.
Connections
TextSplitter accepts a sentence string as input. Connect it to any component that outputs a string.
It outputs a list of strings as output. Connect it to any downstream component that accepts a list of strings.
Source Code
To check this component's source code, open text_splitter.py in the Haystack repository.
Usage Examples
Basic Configuration
TextSplitter:
type: testing.sample_components.text_splitter.TextSplitter
init_parameters: {}
components:
TextSplitter:
type: testing.sample_components.text_splitter.TextSplitter
init_parameters:
Parameters
Inputs
| Parameter | Type | Default | Description |
|---|---|---|---|
sentence | str | The text string to split. |
Outputs
| Parameter | Type | Default | Description |
|---|---|---|---|
output | List[str] | The list of string segments. |
Init Parameters
These are the parameters you can configure in Pipeline Builder:
| Parameter | Type | Default | Description |
|---|
Run Method Parameters
These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.
| Parameter | Type | Default | Description |
|---|---|---|---|
sentence | str | The text string to split. |
Was this page helpful?