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.1

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.1
File Size Uploaded Provenance Actions
splintering-1.0.1.tar.gz 22.6 kB With provenance Details for splintering-1.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 46.9 kB

Release files / splintering-1.0.1.tar.gz

Download URL splintering-1.0.1.tar.gz
Size 22.6 kB
Tags Source
SHA-256 checksum
How to use checksums
08c3f5f27d03ab0ec24846273766e2ab64adb917a0a4ed4fdc62a5616ec89dc6
BLAKE2b-256 checksum
How to use checksums
76ee47a2cd0b91bcafe2a5c97d5100f40bad6ff58a14270d6a7985031bee89d3
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.1-py3-none-any.whl

Download URL splintering-1.0.1-py3-none-any.whl
Size 24.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
30dc96884664c8a6afd6ee5081d3464234c6788de57720b34a4f3547cf4ae40a
BLAKE2b-256 checksum
How to use checksums
ca1609260ef61048aeed2781d7f433c5535531b6b2a148982cb55b561fe54ecd
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.1

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.1.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