[Fix] Correct the _split_text
/_split_sentence
logic to give proper splits
#164
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.
This pull request includes several changes to the chunking functionality, focusing on the handling of delimiters, sentence splitting, and ensuring minimum characters per chunk or sentence. The most important changes include adding the
include_delim
parameter, modifying sentence splitting logic, and updating test cases to cover new functionality.Enhancements to chunking functionality:
src/chonkie/chunker/late.py
: Added theinclude_delim
parameter to theLateChunker
class and updated the_split_sentences
method to handle this parameter. [1] [2] [3]src/chonkie/chunker/semantic.py
: Added theinclude_delim
parameter to theSemanticChunker
class and updated the_split_sentences
method to handle this parameter. [1] [2] [3] [4]src/chonkie/chunker/sentence.py
: Updated the_split_sentences
method to improve the handling of short splits and ensure they are combined correctly.Updates to tests:
tests/chunker/test_recursive_chunker.py
: Added a test case for handling minimum characters per chunk in theRecursiveChunker
.tests/chunker/test_sentence_chunker.py
: Added a test case for handling minimum characters per sentence in theSentenceChunker
.