--- title: Text Operations slug: /text-operations --- import Icon from "@site/src/components/icon"; import PartialParams from '@site/docs/_partial-hidden-params.mdx'; The **Text Operations** component performs operations on text strings. The output type depends on the selected operation: most operations return a `Message`, **Word Count** returns a `JSON` object, and **Text to DataFrame** returns a `Table`. ## Use the Text Operations component in a flow The following example demonstrates how to use a **Text Operations** component to clean text output from a language model before passing it to another component: 1. Create a flow with a **Language Model** component and a **Text Operations** component, and then connect the **Language Model** component's **Message** output to the **Text Operations** component's **Text Input**. All operations in the **Text Operations** component require a text string as input. If the preceding component doesn't produce `Message` or text output, you can use the [**Type Convert** component](/type-convert) to reformat the data first. 2. In the **Operation** field, select the operation you want to perform. For this example, select **Text Clean**. :::tip You can select only one operation. If you need to perform multiple operations, chain multiple **Text Operations** components together to execute each operation in sequence. ::: 3. Configure the operation's parameters. For this example, enable **Remove Extra Spaces** and **Remove Empty Lines** to normalize the model's output. 4. Optional: Connect the output to a **Chat Output** component to view the result in the **Playground**. 5. Click