Regexp Splitter
The Regexp text splitter makes it easy to split text documents at scale base on a string separator or a regular expression.
đ Splitting Text
To use this middleware, you import it in your CDK stack, and connect it to a data source providing text documents, such as the S3 Trigger.
Using Regexps
You can also use native ECMAScript regular expressions to define the separator on which the middleware will split the text documents.
âšī¸ The below example splits text documents based on Markdown code blocks.
đ Output
This middleware takes as an input text documents, and outputs multiple text documents that are the result of the text splitting process. This allows to process each chunk of text in parallel in downstream middlewares.
In addition to producing new text documents, this middleware also associates metadata with each chunk, such as the chunk identifier and order relative to the original document. Below is an example of CloudEvent
produced by this middleware.
đ Click to expand example
đī¸ Architecture
This middleware runs within a Lambda compute based on the ARM64 architecture to run the text splitting process.
đˇī¸ Properties
Supported Inputs
Mime Type | Description |
---|---|
text/plain | UTF-8 text documents. |
Supported Outputs
Mime Type | Description |
---|---|
text/plain | UTF-8 text documents. |
Supported Compute Types
Type | Description |
---|---|
CPU | This middleware only supports CPU compute. |
đ Examples
- Text Splitting Pipeline - Builds a pipeline for splitting text documents using different text splitting algorithms.