Skip to main content
Version: latest

agrag.loaders.common.paragraph_units

paragraph_units(text:str, offset:int = 0) -> list[Unit]

Split text into paragraph units that point at their place in the document.

A blank line ends a paragraph. Each unit span is trimmed of surrounding whitespace.

Parameters:

  • text (str) – The text to split, with LF line endings.
  • offset (int) – The offset of text in the document text.

Returns:

  • list[Unit] – One unit for each non-blank paragraph, in order.