Skip to main contentModule compress
Source - compress_block
- Collapse repeated blank lines while preserving paragraph breaks, and
compress whitespace within each line.
- compress_text
- Semantic text reduction: strip decorative glyphs, then collapse runs of
whitespace, then trim.
- estimate_tokens
- Fast token approximation.
- truncate_preserving_refs
- Truncate
content to max_tokens while keeping a trailing refs_block
(a rendered References: list) intact. - truncate_to_tokens
- Truncate text to roughly
max_tokens, on a character boundary, appending
an elision marker when content is dropped.