MediaPipeTasksRetrieval Framework Reference

TextChunker

protocol TextChunker

Splits long UTF-8 documents into smaller segments suitable for embedding.

  • Partitions text into ordered segments.

    Declaration

    Swift

    func chunk(text: String) throws -> [String]

    Parameters

    text

    Source document text to partition.

    Return Value

    Ordered text chunks, or an empty array when text contains no non-whitespace text.