Repository navigation
Conversation
…itter sentence splits
…itter sentence splits Added functionality to preserve whitespace when splitting sentences.
Add test for sentence separator preserving trailing page breaks and whitespace in RecursiveDocumentSplitter.
Pothan0
requested review from
julian-risch
and
a lite review from Copilot
and removed request for
a team and
Copilot
September 24, 2026 15:56
Contributor
|
@Pothan0 is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
julian-risch
requested review from
bogdankostic
and removed request for
julian-risch
September 28, 2026 08:09
Member
|
Thank you for your efforts! We're closing this PR because it's obsolete: #13006, merged on October 1, fixes the same issue, and this PR's own test passes on main. |
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.
Related Issues
RecursiveDocumentSplitter.Proposed Changes:
RecursiveDocumentSplitterdrops whitespace at the end of a text piece when it splits by"sentence"withkeep_white_spaces=True(the default). NLTK's span tokenizer strips trailing whitespace, so a trailing\for\n\ndisappears from the chunk. The chunks then no longer add up to the original text,page_numberstops advancing, andsplit_idx_startdrifts for every chunk after it.This slices the original text between sentence start offsets instead, so no characters are lost.
keep_white_spaces=Falsekeeps the current behavior.Repro:
On main every chunk reports
page_number1 and"".join(d.content for d in docs) != text.How did you test it?
test_recursive_splitter.pyandtest_sentence_tokenizer.pypass.ruff checkandruff formatclean.Notes for the reviewer
This doesn't change the
page_numberconvention discussed in #12926; it only stops characters from being lost.Prepared with an AI assistant; I've reviewed the change and the tests.
Checklist