Skip to main content
Character-based splitting is the simplest approach to text splitting. It divides text using a specified character sequence (default: "\n\n"), with chunk length measured by the number of characters. Key points:
  1. How text is split: by a given character separator.
  2. How chunk size is measured: by character count.
You can choose between:
  • .split_text — returns plain string chunks.
  • .create_documents — returns LangChain Document objects, useful when metadata needs to be preserved for downstream tasks.
Use .create_documents to propagate metadata associated with each document to the output chunks:
Use .split_text to obtain the string content directly: