TextChunker constructor
TextChunker({})
Creates a chunker.
Implementation
TextChunker({
this.chunkSize = 1000,
this.overlap = 150,
this.separators = const [
'\n\n',
'\n',
'. ',
'? ',
'! ',
'。',
'?',
'!',
'; ',
', ',
' ',
],
}) {
if (chunkSize <= 0) {
throw ArgumentError.value(chunkSize, 'chunkSize', 'must be positive');
}
if (overlap < 0 || overlap >= chunkSize) {
throw ArgumentError.value(
overlap,
'overlap',
'must be in [0, chunkSize)',
);
}
}