1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! `TextSplitter` — sync algorithmic primitive.
//!
//! Slices one [`Document`] into a sequence of smaller `Document`s
//! while preserving every chunk's [`Lineage`](crate::Lineage)
//! reference back to the parent. The output sequence is owned —
//! the input is consumed (or borrowed; both shapes ship via
//! [`split`](Self::split)'s `&Document` signature so callers can
//! re-use the parent if the splitter is non-destructive).
//!
//! Sync by contract — splitters are pure algorithms over text
//! (boundary detection, token-budget bucketing, markdown structure
//! parsing). Mirrors the [`entelix_core::TokenCounter`] discipline:
//! low-level primitives stay pure so they compose with locks and
//! hot paths. Splitters that depend on async resources (LLM-call
//! based segmentation) belong on [`Chunker`](crate::Chunker), not
//! `TextSplitter`.
pub use ;
pub use ;
pub use ;
use crateDocument;
/// Pure-algorithm slice of a [`Document`] into smaller documents.
///
/// Implementations preserve every produced chunk's
/// [`Lineage`](crate::Lineage) so audit / replay flows can walk
/// from any leaf back to the original load. The input
/// `Document::source` and `Document::namespace` flow through
/// every chunk unchanged via [`Document::child`].