Chunkers and Splitters
There are several methods in the content package to help you chunk and split text:
ChunkTexttakes a text string and divides it into chunks of a specified size with a given overlap. It returns a slice of strings, where each string represents a chunk of the original text.
SplitTextWithDelimitersplits the given text using the specified delimiter and returns a slice of strings.
SplitTextWithRegexsplits the given text using the provided regular expression delimiter. It returns a slice of strings containing the split parts of the text.
SplitMarkdownBySectionssplits the given markdown text using the title sections (#, ##, etc.) and returns a slice of strings.
SplitAsciiDocBySectionssplits the given asciidoc text using the title sections (=, ==, etc.) and returns a slice of strings.
SplitHTMLBySectionssplits the given html text using the title sections (h1, h2, h3, h4, h5, h6) and returns a slice of strings.