feat: register Hebrew and Chinese units in Tokenizer API#17
Closed
AmitMY wants to merge 5 commits into
Closed
Conversation
2 tasks
992f398 to
575c5a9
Compare
- Tokenizer(units, merge_size, connected) — configurable base class
- BPETokenizer, BNETokenizer, BoundlessBPETokenizer, SuperBPETokenizer
- Units can be string ("utf8_clusters", "utf8", "characters") or callable
- 10 tests covering all variants, custom units, error handling
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- FastBPETrainer flattens words into byte tuples and counts word frequencies, avoiding repeated graph traversal - Pair counting operates on word-freq dict instead of full corpus - Produces identical merges to graph-based BPE (tested) - Significantly faster on repeated text patterns Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Test training on plain Hebrew, nikkud text, mixed text - Verify dagesh/qamats appear in early merges for repeated patterns - Verify bytes preservation and pretokenization of Hebrew text Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- from complex_tokenization import BPETokenizer, Tokenizer, etc. - Add __all__ for explicit export control - Add import tests Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Test empty text, single char, all same chars, whitespace-only, multiple empty texts for all 4 tokenizer variants - Test emoji, mixed scripts, newlines for all variants - Parametrized across BPE, BNE, Boundless BPE, Super BPE Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
575c5a9 to
6b1cf73
Compare
Contributor
Author
|
Absorbed into #12 — |
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.
Summary
"hebrew"and"chinese"as unit options inTokenizerTokenizer(units="hebrew")uses Hebrew diacritics decompositionTokenizer(units="chinese")uses Chinese IDS decompositionStacked on #16.
What improved
Test plan
ruff check .passes🤖 Generated with Claude Code