Repository navigation
fix: Stop TextChunker once a chunk reaches the end of the text - #7078
Open
patelchaitany wants to merge 1 commit into
Open
patelchaitany wants to merge 1 commit into
patelchaitany wants to merge 1 commit into
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7078 +/- ##
=======================================
Coverage 51.28% 51.28%
=======================================
Files 458 458
Lines 57409 57411 +2
Branches 8415 8416 +1
=======================================
+ Hits 29443 29445 +2
Misses 25957 25957
Partials 2009 2009
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
patelchaitany
force-pushed
the
fix/text-chunker-trailing-chunk
branch
2 times, most recently
from
November 2, 2026 07:48
febedd3 to
fd8350d
Compare
The sliding window kept advancing after the last word was covered, so a leftover window with at least min_chunk_size words was emitted as an extra chunk whose words were all in the previous chunk. Break out of the loop right after the chunk that reaches the end of the text. Fixes feast-dev#7063 Signed-off-by: Chaitany Patel <patelchaitany93@gmail.com>
patelchaitany
force-pushed
the
fix/text-chunker-trailing-chunk
branch
from
November 4, 2026 06:46
fd8350d to
8591807
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
TextChunker._chunk_by_wordskept advancing its sliding window after a chunk had already reached the end of the text. If the leftover window still had at leastmin_chunk_sizewords, it was emitted as another chunk whose words were all in the previous chunk. With the defaultChunkingConfig, a 100-word document produced a redundantw80–w99chunk, andDocEmbedderwould embed and store it as its own row.This PR breaks out of the loop right after the chunk that reaches the end of the text. Texts that do not reach the end produce the same output as before.
Which issue(s) this PR fixes:
Fixes #7063
Checks
git commit -s)Testing Strategy
Misc
Added
test_no_trailing_chunk_contained_in_previous, which fails before this change and passes after it. The existingTestTextChunkertests pass, and ruff check and format are clean.🤖 Generated with Claude Code