Skip to main content

Splintering

This repository contains the code used in Splintering Nonconcatenative Languages for Better Tokenization.

It contains the Splinter algorithm as well as the intrinsic evaluation code.

The downstream evaluation DictaBERT-Splinter models can be found here.

The following example trains Splinter on Hebrew Wikipedia, encodes the training corpus, and uses it to train a BPE tokenizer:

# Training:
from splintering.trainer import SplinterTrainer
from splintering.text_processors import TextProcessorWithEncoding
from splintering.utils.languages import LanguageUtilsFactory, Language
from splintering.utils.paths import SplinterPaths
from splintering.utils.misc import get_corpus_name

folder = SplinterPaths("example")
language = Language.find("Hebrew")
train_dataset_path = 'wikimedia/wikipedia'
train_dataset_name = f'20231101.{language}'
language_utils = LanguageUtilsFactory.get_by_language(language)

# - Create the reductions map, and map the reductions in it into new Unicode characters
splinter_trainer = SplinterTrainer(language_utils, folder)
reductions_map, new_unicode_chars_map, _ = splinter_trainer.train(train_dataset_path, train_dataset_name, None)

# Application:
# - Splinter the corpus
text_processor = TextProcessorWithEncoding(language_utils, reductions_map, new_unicode_chars_map)
text_processor.save_corpus_as_text_file(train_dataset_path, train_dataset_name)

# - Train tokenizer on the splintered corpus 
tokenizer_corpus_path = folder.get_corpus_path(get_corpus_name(train_dataset_path, train_dataset_name))
tokenizer_type = 'bpe'
vocab_size = 128_000

from scripts.train_tokenizer import train_tokenizer  # Thin wrapper around SentencePiece; you can use any package that takes a string corpus.

tokenizer_path = folder.get_tokenizer_path(tokenizer_type=tokenizer_type, vocab_size=vocab_size)
train_tokenizer(folder, tokenizer_type=tokenizer_type, vocab_size=vocab_size, input_path=tokenizer_corpus_path, output_path=tokenizer_path)

Citation

If you use Splinter in your research, please cite Splintering Nonconcatenative Languages for Better Tokenization:

@inproceedings{gazit-etal-2025-splintering,
    title = "Splintering Nonconcatenative Languages for Better Tokenization",
    author = "Gazit, Bar  and
      Shmidman, Shaltiel  and
      Shmidman, Avi  and
      Pinter, Yuval",
    editor = "Che, Wanxiang  and
      Nabende, Joyce  and
      Shutova, Ekaterina  and
      Pilehvar, Mohammad Taher",
    booktitle = "Findings of the {A}ssociation for {C}omputational {L}inguistics: {ACL} 2025",
    month = jul,
    year = "2025",
    address = "Vienna, Austria",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2025.findings-acl.1151/",
    doi = "10.18653/v1/2025.findings-acl.1151",
    pages = "22405--22417",
    ISBN = "979-8-89176-256-5"
}

Metadata

Release files for splintering 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for splintering 1.0.2
File Size Uploaded Provenance Actions
splintering-1.0.2.tar.gz 22.6 kB With provenance Details for splintering-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for splintering 1.0.2
File Interpreter ABI Platform Actions
splintering-1.0.2-py3-none-any.whl Python 3 none any Details for splintering-1.0.2-py3-none-any.whl

Total release size: 46.9 kB

Release files / splintering-1.0.2.tar.gz

Download URL splintering-1.0.2.tar.gz
Size 22.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7e961fd882d5172b5efd4dc8bbcf5a48f90768ab1d436e763f0cff2acb37dd3c
BLAKE2b-256 checksum
How to use checksums
34a9febc37d1a042613871e12b3ee4dc9480056d747b8b63c00938a668f5ce0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / splintering-1.0.2-py3-none-any.whl

Download URL splintering-1.0.2-py3-none-any.whl
Size 24.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3a2bf0ee10bdcc50be27889b72cd3801efea24956b740b5eae56517b6a345b3
BLAKE2b-256 checksum
How to use checksums
9bcb177a7058e443d4e0383f0a74b34e676ddf670031eabbc6a869ff9e2736ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for splintering 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for splintering-1.0.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page