Splits text into sentence-level chunks using the Alignment.Tokenizer.
Sentence boundary rules (mirroring upstream's find_sentence_range):
- A
:punctuationtoken ending in a sentence terminator (.,!,?, CJK equivalents —...counts, since symbol runs are one token) ends a sentence, unless the previous token plus the terminator form a known abbreviation ("Dr" <> "." == "Dr."). - After sentence-ending punctuation, trailing closing punctuation
(
",',),],},»,”,’) is consumed into the same sentence. - A
:whitespacetoken containing\nstarts a new sentence unless the next token begins lowercase — lines opening with quotes, digits, or capitals all break (upstream: "assume break unless lowercase").
Summary
Functions
Splits text into chunks respecting sentence boundaries.
Functions
@spec chunk( String.t(), keyword() ) :: [LangExtract.Chunker.Chunk.t()]
Splits text into chunks respecting sentence boundaries.
Options
:max_chunk_chars— maximum characters per chunk (required)