feat: add chunking module, remove chonkie#84
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 5 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Pringled
approved these changes
May 11, 2026
Member
Pringled
left a comment
There was a problem hiding this comment.
Couple of small comments but looks great
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.
This PR removes chonkie from semble. One of Chonkie's direct dependencies, tokie, was causing installation failures for users on python 3.14. As
uvxdefaults to the latest stable release of python, users without a pre-existing python environment would pull 3.14 when running, e.g.,See #81 and #80 for examples of this issue. Upon closer inspection, we don't use any features from either chonkie or tokie in our code, except the code chunker. As the code chunker is mostly a refinement algorithm on top of
tree-sitter, we opted to reimplement this algorithm.The actual PR implements a recursive algorithm on top of either:
The algorithm works as follows. Given a hierarchically organized set of chunks, all of which have a start and end span, and a desired chunk size, we create chunks by grouping adjacent chunks if they're below the chunk size. If a chunk is larger than the desired chunk size, we instead split it into its children, and then perform the same algorithm. After this, we then perform a refinement step where we merge adjacent chunks.
For 2), above, we only perform the second step, as lines are not organized hierarchically.
The PR removes 11 dependencies, and maintains 100% test coverage. Performance on our internal benchmark is maintained.