You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature #482 [Store] Add constructor with configurable chunk size and overlap to TextSplitTransformer (OskarStark)
This PR was merged into the main branch.
Discussion
----------
[Store] Add constructor with configurable chunk size and overlap to `TextSplitTransformer`
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| Docs? | no
| Issues | --
| License | MIT
Commits
-------
17b3adb Add constructor with configurable chunk size and overlap to TextSplitTransformer
Copy file name to clipboardExpand all lines: src/store/src/Document/Transformer/TextSplitTransformer.php
+11-2Lines changed: 11 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -29,13 +29,22 @@
29
29
publicconstOPTION_CHUNK_SIZE = 'chunk_size';
30
30
publicconstOPTION_OVERLAP = 'overlap';
31
31
32
+
publicfunction__construct(
33
+
privateint$chunkSize = 1000,
34
+
privateint$overlap = 200,
35
+
) {
36
+
if ($this->overlap < 0 || $this->overlap >= $this->chunkSize) {
37
+
thrownewInvalidArgumentException(\sprintf('Overlap must be non-negative and less than chunk size. Got chunk size: %d, overlap: %d', $this->chunkSize, $this->overlap));
0 commit comments