-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve text splitter to avoid cutting words in chunks #242
Open
NathalieCharbel
wants to merge
11
commits into
neo4j:main
Choose a base branch
from
NathalieCharbel:approximate-fixed-size-splitter
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Improve text splitter to avoid cutting words in chunks #242
NathalieCharbel
wants to merge
11
commits into
neo4j:main
from
NathalieCharbel:approximate-fixed-size-splitter
Conversation
This file contains 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
stellasia
reviewed
Jan 11, 2025
src/neo4j_graphrag/experimental/components/text_splitters/fixed_size_splitter.py
Outdated
Show resolved
Hide resolved
stellasia
reviewed
Jan 13, 2025
src/neo4j_graphrag/experimental/components/text_splitters/fixed_size_splitter.py
Show resolved
Hide resolved
stellasia
reviewed
Jan 13, 2025
src/neo4j_graphrag/experimental/components/text_splitters/fixed_size_splitter.py
Show resolved
Hide resolved
stellasia
reviewed
Jan 20, 2025
tests/unit/experimental/components/text_splitters/test_fixed_size_splitter.py
Show resolved
Hide resolved
LGTM, just a minor question in the tests. Also, remember to add a line in the CHANGELOG (in a |
NathalieCharbel
force-pushed
the
approximate-fixed-size-splitter
branch
from
January 20, 2025 14:56
27c5fd3
to
385492b
Compare
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.
Description
Add optional approximate splitting Flag to FixedSizeSplitte to ensure chunks start and end cleanly without words cut in the middle, honouring a desired chunk size and overlap. Also, “no whitespace found” fallbacks are considered during both chunk start and end adjustments, ensuring that if a large word has no whitespace, we revert to the original boundary to avoid unexpected behaviour.
Type of Change
Complexity
Complexity: Medium
How Has This Been Tested?
Checklist
The following requirements should have been met (depending on the changes in the branch):