View Categories

Text Transformer

Text manipulation is fundamental to creating efficient workflows. This article explains in a simple way how to use the “Text Transformer” node in AI Content Labs, which allows you to do everything from changing the format of a text to counting words or removing duplicates, all without having to deal with complex processes.

What is the Text Transformer node and what is it for?

The Text Transformer is a component that takes text as input and processes it according to the chosen transformation. Its main objective is to save you steps when adjusting, cleaning, or formatting information that can then be passed to other nodes in the flow (for example, a “Prompt” node to generate content, or a “Text Splitter” node to split it into parts and then reuse it).

View of the Text Transformer node in the diagram

Configurations

When configuring the node, you will see a “Source” field to select the desired transformation. All options have the Continue on error feature, which returns the original text in case something fails. The main transformations are described below:

Basic configuration of the Text Transformer

Configuration of another transformation, changing the text to uppercase or capitalized

Convert text to slug

Converts the input text into a suitable format for URLs, replacing spaces and special characters.

  • Example: “My special product” → “my-special-product”.

Extract specific parts of the text

Allows you to take only the section that interests you from a text.

  • Options: first sentence, first paragraph, based on separator (for example, “,”), start-end positions, or regular expressions.
  • Example: With a separator “/”, the text “title/subtitle/content” could extract “subtitle”.

Convert uppercase/lowercase

Modifies the format of the text to Capitalize, put it all in uppercase or lowercase.

  • Example: “hello world” → Capitalize → “Hello world”.

Remove extra spaces

Removes redundant whitespace between words.

  • Example: “ Hello world ! ” → “Hello world !”.

Replace text

Replaces specific parts with another string.

  • Options: replace all occurrences, only the first, or the first N.
  • Example: “Hello Hello Hello” → replace the first 2 with “Goodbye” → “Goodbye Goodbye Hello”.

Remove punctuation or special characters

Cleans unwanted symbols (punctuation, special characters, or both).

  • Example: “Hello! How are you?” → “Hello How are you?”.

Count words or characters

Calculates how many words or characters the text contains.

  • Example: “Open AI Content Labs”. Words: 4; Characters: 20 (including spaces).

Convert to specific case format

Transforms the text into CamelCase, snake_case, or kebab-case.

  • Example: “example text” → snake_case → “example_text”.

Remove duplicate words

Identifies and removes repeated terms.

  • Example: “one two two three three three” → “one two three”.

Escape HTML characters

Converts “<”, “>”, “&” and other special characters to their HTML-safe version.

  • Example: “ <Hello & “World”>” → “ &lt;Hello &amp; &quot;World&quot;&gt;”.

Remove HTML tags

Removes any tag, keeping only the content.

  • Example: “<b>Text</b> in <i>bold</i>” → “Text in bold”.

Normalize text

Removes strange characters and standardizes it.

  • Example: “café” (with a special accent) → “cafe”.

Remove Markdown formatting

Converts Markdown formatted text to plain text.

  • Example: “ **Bold** and *italic*” → “Bold and italic”.

Count word frequency

Analyzes how many times each word appears, with the option to exclude certain words or apply a filter by minimum frequency.

  • Example: “AI AI Content Labs, AI Content?” → ai [3], content [2], labs [1] .

Trim text to length

Allows you to set a maximum number of characters or words, with the option to add “…” and respect whole words.

  • Example: “Hello world of AI” (maximum 3 words + “…”) → “Hello world of…”.

Available transformation options

Usage tips

  • Integrate this node after an Input Node to clean or normalize the text before sending it to a Prompt.
  • Use it after a Text Splitter to process each segment separately, or before a Text Merger to merge texts with the correct format.
  • Combine “Trim text to length” with a Prompt when you need to adjust messages to a limited size (for example, for social media posts).
  • If you want to apply several changes, you can use multiple instances of the Transformer in a chain (for example, first “Remove HTML tags” and then “Convert text to slug”).

In short, the Text Transformer node offers multiple possibilities to adjust and perfect content in an agile way. Take advantage of its options to optimize your workflow and ensure that the final text meets your requirements exactly.