Skip to main content

interstiCy

A fast Rust implementation of spaCy tokenization with Python bindings.

Overview

interstiCy is a Rust reimplementation of spaCy's English tokenizer, exposed to Python via PyO3 and maturin. It aims to be a drop-in tokenizer replacement for spacy.blank("en") and produces matching token boundaries, whitespace flags, and character-level spans.

Current scope: English only. Multi-language support is planned, but the rules and special-case loader are English-specific until loaders for other languages are added.

API

Default entry points:

  • For spaCy integration: intersticy.create_tokenizer(nlp)
  • For direct batch use: Tokenizer.load_from_spacy().tokenize_with_spans_batch(texts)

The detailed API is the primary interface:

from intersticy import Tokenizer

tok = Tokenizer.load_from_spacy()

# Single text, returns (start_char, end_char, text, has_space_after)
for start, end, text, space in tok.tokenize_with_spans("Hello, world!"):
    print(repr(text), start, end, space)
# ('Hello', 0, 5, False)
# (',', 5, 6, True)
# ('world', 7, 12, False)
# ('!', 12, 13, False)

# Batch, releases the GIL and tokenizes across cores
results = tok.tokenize_with_spans_batch([text1, text2, ...])

# String-only batch (no offsets, less overhead)
words = tok.tokenize_batch([text1, text2, ...])

# Offsets-only batch (no per-token PyString allocation)
spans = tok.tokenize_with_offsets_batch([text1, text2, ...])
# Each tuple is (start_char, end_char, has_space_after); recover text with text[start:end]

A string-only convenience method is also available:

print(tok.tokenize("Hello, world!"))
# ['Hello', ',', 'world', '!']

For spaCy integration, wrap the tokenizer as a replacement:

import spacy
import intersticy

nlp = spacy.load("en_core_web_sm")
nlp.tokenizer = intersticy.create_tokenizer(nlp)

doc = nlp("Hello, world!")
print([t.text for t in doc])
# ['Hello', ',', 'world', '!']

Benchmarks

All timings are for tokenization only, measured against spacy.blank("en") on the same machine and text.

Workload spaCy interstiCy Speedup
Repetitive English paragraph (~200 k chars, cache-heavy) ~218 ms ~17 ms ~13x
Real-world prose (Pride and Prejudice, 728 k chars) ~700 ms ~60 ms ~11.8x
128 chunks of ~50 k chars, batch vs sequential — — ~2.2x on 8 cores

Batch APIs release the GIL and run across all cores. Larger chunks generally scale better; end-to-end pipelines spend most of their time on tagging, parsing, and NER, so the overall speedup there is smaller than the tokenizer-only figures above.

Run the standalone benchmarks yourself:

python benchmarks/benchmark.py
python benchmarks/prototype_benchmark.py

The first script downloads the public-domain Project Gutenberg text of Pride and Prejudice and reports both single-text and batch throughput. The second script compares the different batch APIs and a Rust-only count to show where the batch scaling ceiling comes from.

Parity

interstiCy is tested against spaCy for byte-level token boundaries, text, and whitespace flags.

Latest reported run (spaCy 3.8.14):

  • Corpus: Project Gutenberg, Pride and Prejudice
  • Text length: 728,798 characters
  • Token count: 164,234 tokens
  • Mismatches: 0
  • Span/whitespace parity: passed

Installation

pip install intersticy

Development

python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
pytest

License

MIT

Metadata

Release files for intersticy 0.2.5

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

Source distribution (sdist)

Source distribution for intersticy 0.2.5
File Size Uploaded Provenance Actions
intersticy-0.2.5.tar.gz 47.7 kB Without provenance Details for intersticy-0.2.5.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for intersticy 0.2.5
File Actions
intersticy-0.2.5-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for intersticy-0.2.5-cp39-abi3-win_amd64.whl
intersticy-0.2.5-cp39-abi3-win32.whl CPython 3.9 abi3 Windows x86-32 Details for intersticy-0.2.5-cp39-abi3-win32.whl
intersticy-0.2.5-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for intersticy-0.2.5-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
intersticy-0.2.5-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-32 Details for intersticy-0.2.5-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
intersticy-0.2.5-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl CPython 3.9 abi3 Linux glibc 2.17+ ARMv7l Details for intersticy-0.2.5-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
intersticy-0.2.5-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for intersticy-0.2.5-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
intersticy-0.2.5-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for intersticy-0.2.5-cp39-abi3-macosx_11_0_arm64.whl

Total release size: 8.1 MB

Release files / intersticy-0.2.5.tar.gz

Download URL intersticy-0.2.5.tar.gz
Size 47.7 kB
Tags Source
SHA-256 checksum
How to use checksums
739bffe0e500daf2c763fbff9b05591122781ce8d72d0c702cde7f45c1676fbf
BLAKE2b-256 checksum
How to use checksums
dcd77ebb81c0918b9d1a833be306450d9ce450da36ebf90906b9d0daaac161da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / intersticy-0.2.5-cp39-abi3-win_amd64.whl

Download URL intersticy-0.2.5-cp39-abi3-win_amd64.whl
Size 1.0 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
f34278f1aa04a1854ca0060e404d840bfd4fa5d745c3a00bf6e309b4efa33cfd
BLAKE2b-256 checksum
How to use checksums
da50f991a3df2bfd039697ef4a8b679df908836e99937617fdcc6b213622f64b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / intersticy-0.2.5-cp39-abi3-win32.whl

Download URL intersticy-0.2.5-cp39-abi3-win32.whl
Size 901.4 kB
Tags CPython 3.9 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
820cff1ef73df0fd91035dbf8c47f938ccd5ffb69aab81d67af8caaa9878502d
BLAKE2b-256 checksum
How to use checksums
f85164616a99777d9c2ee686f697b29f5f628b5c9156e91713cf7b56ec1690b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / intersticy-0.2.5-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL intersticy-0.2.5-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.3 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
be4686a55d87957cb9016461356feddc789091d8f1879db20c4ba5f77ca9a459
BLAKE2b-256 checksum
How to use checksums
c9582897c54bdf931f7ddd79d844ec2bea39e54a88a55d2d7febcc4b25f99770
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / intersticy-0.2.5-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL intersticy-0.2.5-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Size 1.3 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-32 abi3
SHA-256 checksum
How to use checksums
b664decd56f574039b55ad8cdbc6cd6ca76f39ac31a3d0da59bff52dc1d5483f
BLAKE2b-256 checksum
How to use checksums
591687c893733708ee2d8824235c12d29064c28781a307604708e15e38cdfb4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / intersticy-0.2.5-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl

Download URL intersticy-0.2.5-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Size 1.2 MB
Tags CPython 3.9 Linux glibc 2.17+ ARMv7l abi3
SHA-256 checksum
How to use checksums
4f269fa9f0d8896a8403bd270f4ed85ee06d8677b458402a4f6ae11b9f653199
BLAKE2b-256 checksum
How to use checksums
1f613c60b5720609ffad70542c8b085d8606fbdf507dcb5dd91d23694381353c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / intersticy-0.2.5-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL intersticy-0.2.5-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.3 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
c8c3ef3854b718f7b32cdf5ab5fdd9c4864688d09f3e6b0d4c19566fc124f319
BLAKE2b-256 checksum
How to use checksums
bdd7d4f79674fc0954ac61e83fb9021a2a30f85af81491113f26fd40ef8364e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / intersticy-0.2.5-cp39-abi3-macosx_11_0_arm64.whl

Download URL intersticy-0.2.5-cp39-abi3-macosx_11_0_arm64.whl
Size 1.1 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b9dc9221d799e30e626825f8830d8c08fc05f02b393c1bf44614dee14331fc1b
BLAKE2b-256 checksum
How to use checksums
f550178211f301be4ca8009934cdaa2660f0cd17d6032e0981fa230a727bf962
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for intersticy 0.2.5

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.2.5 This release

8 release files No provenance

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