Skip to content

Semantic Text Splitter

Semantic Text Splitter compares the meaning of consecutive sentences and cuts where the topic changes. That way each piece is about a single thing, even if pieces come out in different sizes. It needs an embeddings component to compare sentences.

Long documents are cut into pieces before being stored in a vector database: that way each search returns only the piece that answers, not the whole document.

When to use it

  • Your documents mix topics without a clear section structure.
  • You want pieces that deal with a single matter.

Configuration

FieldWhat it does
Data Inputs (required)The texts to cut.
Embeddings (required)The embeddings component that compares sentences.
Breakpoint Threshold TypeHow to decide where to cut: percentile (default), standard_deviation or interquartile.
Breakpoint Threshold AmountHow much the meaning must change to cut (with percentile, from 0 to 100, for example 95). Only used when Number Of Chunks is 0. Default: 0.5.
Number Of ChunksHow many pieces to try to split the text into. Set it to 0 to let Breakpoint Threshold Amount decide where to cut. Default: 5.

Advanced options

FieldWhat it does
Sentence Split RegexPattern to separate sentences, if your texts need it. Optional.
Buffer SizeHow many neighbouring sentences are taken into account when comparing. Default: 0.

Output

The Data output holds the pieces, each with the data of the document it comes from. Connect it to Ingest Data of a vector database, such as Chroma DB.

Example

A consultancy has meeting minutes covering several matters in a row.

  1. Connect the minutes to Data Inputs and an embeddings component to Embeddings.
  2. Connect Data to a vector database to search by matter.

Good practices

  • Cutting this way queries the embeddings service for each sentence: it costs money on very long texts.