This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
split_recursive( data; delimiters, chunk_size ) | |
Recursively split the data using the provided delimiters (default: ["\n\n", "\n", " ", " "]) | |
in ordered manner and chunk_size (default: 4096). The function will split the data using the | |
first delimiter and then recursively split the chunks using the next delimiter if the chunk | |
size is larger than the provided chunk_size. If all delimiters are exhausted then the function | |
will split the data based on the chunk_size. The function will merge consecutive chunks if they | |
are smaller than chunk_size. |