Open Source Tokenization & Preprocessing

The unglamorous first step of every text pipeline: tokenizers, stemmers, lemmatizers, spell checkers and text cleaning utilities.

178
projects
269.4K โ˜…
total stars
+659
stars this week
Python
top language

ranked by GitHub stars ยท updated Nov 12, 2026

๐Ÿ”ฅ Trending this week in Tokenization & Preprocessing

Tokenization & Preprocessing

rasbt/LLMs-from-scratch๐Ÿ”ฅ active

โ–ฒ +441 โ˜… this week

Implement a ChatGPT-like LLM in PyTorch from scratch, step by step

๐Ÿค– Language Models๐Ÿง  Natural Language Processing
Jupyter NotebookOtherupdated Nov 9, 2026
GitHub โ†—โ˜… 108.3Kโ‘‚ 16.7K
Tokenization & Preprocessing

adbar/trafilatura๐Ÿ”ฅ active

โ–ฒ +43 โ˜… this week

Python & Command-line tool to gather text and metadata on the Web: Crawling, scraping, extraction, output as CSV, JSON, HTML, MD, TXT, XML

๐Ÿ” Search & Retrieval๐Ÿง  Natural Language Processing๐Ÿ’Ž Text Mining
PythonApache-2.0updated Nov 11, 2026
GitHub โ†—โ˜… 7.1Kโ‘‚ 505
Tokenization & Preprocessing

snchimata/tokenfold๐Ÿ”ฅ active

โ–ฒ +31 โ˜… this week

Private, provider-neutral context compression for LLMs. Reversibly compress schemas and logs inside your perimeter with zero third-party calls.

RustApache-2.0updated Nov 12, 2026
GitHub โ†—โ˜… 132โ‘‚ 27
Tokenization & Preprocessing

explosion/spaCy

โ–ฒ +21 โ˜… this week

๐Ÿ’ซ Industrial-strength Natural Language Processing (NLP) in Python

๐Ÿง  Natural Language Processing๐Ÿท๏ธ Named Entity Recognition๐Ÿ—‚๏ธ Text Classification
PythonMITupdated Oct 27, 2026
GitHub โ†—โ˜… 34Kโ‘‚ 4.7K
Tokenization & Preprocessing

toon-format/toon๐Ÿ”ฅ active

โ–ฒ +18 โ˜… this week

๐ŸŽ’ Token-Oriented Object Notation (TOON) โ€“ compact, human-readable serialization of JSON data for LLM prompts. TypeScript SDK, CLI, benchmarks.

TypeScriptMITupdated Nov 11, 2026
GitHub โ†—โ˜… 25.6Kโ‘‚ 1.1K
Tokenization & Preprocessing

myylogic/cevahir-ai

โ–ฒ +9 โ˜… this week

Full-stack open-source AI engine for building language models โ€” tokenizer training, transformer architecture, cognitive reasoning and chat pipeline.

๐Ÿ” Search & Retrieval๐Ÿค– Language Models๐Ÿง  Natural Language Processing
PythonApache-2.0updated Oct 13, 2026
GitHub โ†—โ˜… 288โ‘‚ 9

Top 30 tokenizers and text preprocessing tools by stars

Tokenization & Preprocessing๐Ÿฅ‡#1

rasbt/LLMs-from-scratch๐Ÿ”ฅ active

โ–ฒ +441 โ˜… this week

Implement a ChatGPT-like LLM in PyTorch from scratch, step by step

๐Ÿค– Language Models๐Ÿง  Natural Language Processing
Jupyter NotebookOtherupdated Nov 9, 2026
GitHub โ†—โ˜… 108.3Kโ‘‚ 16.7K
Tokenization & Preprocessing๐Ÿฅˆ#2

explosion/spaCy

โ–ฒ +21 โ˜… this week

๐Ÿ’ซ Industrial-strength Natural Language Processing (NLP) in Python

๐Ÿง  Natural Language Processing๐Ÿท๏ธ Named Entity Recognition๐Ÿ—‚๏ธ Text Classification
PythonMITupdated Oct 27, 2026
GitHub โ†—โ˜… 34Kโ‘‚ 4.7K
Tokenization & Preprocessing๐Ÿฅ‰#3

toon-format/toon๐Ÿ”ฅ active

โ–ฒ +18 โ˜… this week

๐ŸŽ’ Token-Oriented Object Notation (TOON) โ€“ compact, human-readable serialization of JSON data for LLM prompts. TypeScript SDK, CLI, benchmarks.

TypeScriptMITupdated Nov 11, 2026
GitHub โ†—โ˜… 25.6Kโ‘‚ 1.1K
Tokenization & Preprocessing#4

adbar/trafilatura๐Ÿ”ฅ active

โ–ฒ +43 โ˜… this week

Python & Command-line tool to gather text and metadata on the Web: Crawling, scraping, extraction, output as CSV, JSON, HTML, MD, TXT, XML

๐Ÿ” Search & Retrieval๐Ÿง  Natural Language Processing๐Ÿ’Ž Text Mining
PythonApache-2.0updated Nov 11, 2026
GitHub โ†—โ˜… 7.1Kโ‘‚ 505
Tokenization & Preprocessing#5

theseer/tokenizer

โ–ฒ +1 โ˜… this week

A small library for converting tokenized PHP source code into XML (and potentially other formats)

PHPOtherupdated Feb 3, 2026
GitHub โ†—โ˜… 5.2Kโ‘‚ 25
Tokenization & Preprocessing#6

crate-ci/typos๐Ÿ”ฅ active

Source code spell checker

RustApache-2.0updated Nov 11, 2026
GitHub โ†—โ˜… 4.2Kโ‘‚ 189
Tokenization & Preprocessing#7

JohnSnowLabs/spark-nlp๐Ÿ”ฅ active

โ–ฒ +3 โ˜… this week

State of the Art Natural Language Processing

๐Ÿง  Natural Language Processing๐Ÿท๏ธ Named Entity Recognition๐Ÿ’– Sentiment Analysis๐Ÿ—‚๏ธ Text Classificationโ“ Question Answering๐ŸŒ Machine Translation
ScalaApache-2.0updated Nov 12, 2026
GitHub โ†—โ˜… 4.2Kโ‘‚ 743
Tokenization & Preprocessing#8

marcelroed/gigatoken

โ–ฒ +4 โ˜… this week

Language model tokenization at GB/s

๐Ÿง  Natural Language Processing
RustMITupdated Nov 2, 2026
GitHub โ†—โ˜… 4.2Kโ‘‚ 226
Tokenization & Preprocessing#9

andialbrecht/sqlparse

A non-validating SQL parser module for Python

PythonBSD-3-Clauseupdated Nov 1, 2026
GitHub โ†—โ˜… 4Kโ‘‚ 781
Tokenization & Preprocessing#10

jbesomi/texthero

Text preprocessing, representation and visualization from zero to hero.

๐Ÿงฌ Embeddings๐Ÿง  Natural Language Processing๐Ÿ’Ž Text Mining
PythonMITupdated Aug 29, 2023
GitHub โ†—โ˜… 2.9Kโ‘‚ 235
Tokenization & Preprocessing#11

Chevrotain/chevrotain๐Ÿ”ฅ active

โ–ฒ +1 โ˜… this week

Parser Building Toolkit for JavaScript

TypeScriptApache-2.0updated Nov 12, 2026
GitHub โ†—โ˜… 2.8Kโ‘‚ 222
Tokenization & Preprocessing#12

hunspell/hunspell๐Ÿ”ฅ active

The most popular spellchecking library.

๐Ÿง  Natural Language Processing
C++LGPL-2.1updated Nov 8, 2026
GitHub โ†—โ˜… 2.6Kโ‘‚ 287
Tokenization & Preprocessing#13

AgentOps-AI/tokencost

โ–ฒ +3 โ˜… this week

Easy token price estimates for 400+ LLMs. TokenOps.

๐Ÿค– Language Models
PythonMITupdated Sep 5, 2025
GitHub โ†—โ˜… 2Kโ‘‚ 108
Tokenization & Preprocessing#14

dqbd/tiktokenizer

โ–ฒ +2 โ˜… this week

Online playground for OpenAPI tokenizers

TypeScriptMITupdated Apr 24, 2025
GitHub โ†—โ˜… 1.7Kโ‘‚ 188
Tokenization & Preprocessing#16

securitybunker/databunker๐Ÿ”ฅ active

โ–ฒ +3 โ˜… this week

Secure Vault for Customer PII/PHI/PCI/KYC Records

GoMITupdated Nov 10, 2026
GitHub โ†—โ˜… 1.5Kโ‘‚ 102
Tokenization & Preprocessing#17

lunasec-io/lunasec

โ–ฒ +1 โ˜… this week

LunaSec - Dependency Security Scanner that automatically notifies you about vulnerabilities like Log4Shell or node-ipc in your Pull Requests and Builds. Protect yourself in 30 seconds with the LunaTrace GitHub App: https://github.com/marketplace/lunatrace-by-lunasec/

TypeScriptOtherupdated May 2, 2024
GitHub โ†—โ˜… 1.5Kโ‘‚ 165
Tokenization & Preprocessing#18

roshan-research/hazm

โ–ฒ +1 โ˜… this week

Persian NLP Toolkit

๐Ÿง  Natural Language Processing๐Ÿ’Ž Text Mining
PythonMITupdated Apr 1, 2026
GitHub โ†—โ˜… 1.4Kโ‘‚ 207
Tokenization & Preprocessing#19

natasha/natasha

Solves basic Russian NLP tasks, API for lower level Natasha projects

๐Ÿท๏ธ Named Entity Recognition๐Ÿง  Natural Language Processing
PythonMITupdated Oct 14, 2026
GitHub โ†—โ˜… 1.4Kโ‘‚ 122
Tokenization & Preprocessing#20

SeanLee97/xmnlp

xmnlp๏ผšๆไพ›ไธญๆ–‡ๅˆ†่ฏ, ่ฏๆ€งๆ ‡ๆณจ, ๅ‘ฝๅไฝ“่ฏ†ๅˆซ๏ผŒๆƒ…ๆ„Ÿๅˆ†ๆž๏ผŒๆ–‡ๆœฌ็บ ้”™๏ผŒๆ–‡ๆœฌ่ฝฌๆ‹ผ้Ÿณ๏ผŒๆ–‡ๆœฌๆ‘˜่ฆ๏ผŒๅๆ—้ƒจ้ฆ–๏ผŒๅฅๅญ่กจๅพๅŠๆ–‡ๆœฌ็›ธไผผๅบฆ่ฎก็ฎ—็ญ‰ๅŠŸ่ƒฝ

๐Ÿ’– Sentiment Analysis๐Ÿท๏ธ Named Entity Recognition๐Ÿงฌ Embeddings๐Ÿง  Natural Language Processing
PythonApache-2.0updated Nov 12, 2022
GitHub โ†—โ˜… 1.3Kโ‘‚ 181
Tokenization & Preprocessing#21

uhop/stream-json๐Ÿ”ฅ active

A micro-library of stream components for building custom JSON and JSONC processing pipelines with a minimal memory footprint โ€” parse, filter, and transform JSON far larger than available memory with a SAX-inspired token API, on Node.js or Web Streams.

JavaScriptBSD-3-Clauseupdated Nov 9, 2026
GitHub โ†—โ˜… 1.2Kโ‘‚ 59
Tokenization & Preprocessing#22

RavenProject/Ravencoin

โ–ฒ +1 โ˜… this week

Ravencoin Core integration/staging tree

CMITupdated Aug 18, 2026
GitHub โ†—โ˜… 1.1Kโ‘‚ 729
Tokenization & Preprocessing#23

sylvainhalle/textidote

Spelling, grammar and style checking on LaTeX documents

JavaGPL-3.0updated Sep 9, 2026
GitHub โ†—โ˜… 1.1Kโ‘‚ 75
Tokenization & Preprocessing#24

jfilter/clean-text

โ–ฒ +2 โ˜… this week

๐Ÿงน Python package for text cleaning

๐Ÿง  Natural Language Processing
PythonOtherupdated Oct 26, 2026
GitHub โ†—โ˜… 1Kโ‘‚ 82
Tokenization & Preprocessing#25

lovit/soynlp

ํ•œ๊ตญ์–ด ์ž์—ฐ์–ด์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•œ ํŒŒ์ด์ฌ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์ž…๋‹ˆ๋‹ค. ๋‹จ์–ด ์ถ”์ถœ/ ํ† ํฌ๋‚˜์ด์ € / ํ’ˆ์‚ฌํŒ๋ณ„/ ์ „์ฒ˜๋ฆฌ์˜ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

๐Ÿง  Natural Language Processing
PythonOtherupdated Oct 4, 2026
GitHub โ†—โ˜… 996โ‘‚ 181
Tokenization & Preprocessing#26

ikawaha/kagome๐Ÿ”ฅ active

Self-contained Japanese Morphological Analyzer written in pure Go

๐Ÿง  Natural Language Processing
GoMITupdated Nov 11, 2026
GitHub โ†—โ˜… 987โ‘‚ 61
Tokenization & Preprocessing#27

JohnSnowLabs/nlu

1 line for thousands of State of The Art NLP models in hundreds of languages The fastest and most accurate way to solve text problems.

๐Ÿ’– Sentiment Analysis๐Ÿท๏ธ Named Entity Recognition๐Ÿ“ Text Summarization๐Ÿ—‚๏ธ Text Classification๐Ÿงฌ Embeddings
PythonOtherupdated Jan 28, 2025
GitHub โ†—โ˜… 966โ‘‚ 139
Tokenization & Preprocessing#28

AmoDinho/datacamp-python-data-science-track

โ–ฒ +2 โ˜… this week

All the slides, accompanying code and exercises all stored in this repo. ๐ŸŽˆ

๐Ÿง  Natural Language Processing
PythonMITupdated Jul 17, 2023
GitHub โ†—โ˜… 907โ‘‚ 523
Tokenization & Preprocessing#29

no-context/moo

โ–ฒ +2 โ˜… this week

Optimised tokenizer/lexer generator! ๐Ÿ„ Uses /y for performance. Moo.

JavaScriptBSD-3-Clauseupdated Feb 27, 2026
GitHub โ†—โ˜… 885โ‘‚ 74
Tokenization & Preprocessing#30

wangfenjin/simple

โ–ฒ +1 โ˜… this week

ๆ”ฏๆŒไธญๆ–‡ๅ’Œๆ‹ผ้Ÿณ็š„ SQLite fts5 ๅ…จๆ–‡ๆœ็ดขๆ‰ฉๅฑ• ๏ฝœ A SQLite3 fts5 tokenizer which supports Chinese and PinYin

C++Otherupdated May 17, 2026
GitHub โ†—โ˜… 875โ‘‚ 113

๐Ÿ“„ New research on Tokenization & Preprocessing

๐Ÿ“„ arXiv:2611.13990 ยท cs.CL2d ago

On the information rate of phones, syllables and words

Herman Kamper

๐Ÿ’ฌ 5 pages, 1 table, 2 figures

Which linguistic units minimise the bitrate required to encode speech content: phones, syllables, words, maybe larger units, or something in between? This question has implications for the development of speech and language systems and theories of human language processing. Using a transcribed corpus of 960 hours of English audiobooks, I compare the information rates of phones, syllables, words, multi-word combinations and intermediate tokenisations. While all units are equivalent under a perfect language model, it makes sense to compare these under limited modelling budgets; I use $n$-gram and transformer language models. The lowest bitrates are achieved using words, with slightly longer units sometimes performing best. The results show that, when modelling capacity is limited, units larger than syllables but smaller than long multi-word phrases provide the most efficient representation in terms of information rate.โ–ผ more
โœ‚๏ธ Tokenization & Preprocessing๐ŸŽ™๏ธ Speech Recognition๐Ÿค– Language Models
๐Ÿ“„ arXiv:2611.13607 ยท cs.CL2d ago

One Byte, One Token: Byteifying a 27B Hybrid-Attention LLM with Self-Generated Data

Liwei Zhang, ZhiMing Tong

๐Ÿ’ฌ Full text in English followed by the full text in Chinese. 39 pages, 2 figures, 7 tables. Code and task suite: https://huggingface.co/datasets/leiwhere/ld3-byte-eval

Byte-level BPE fragments Chinese text (for Qwen3.8 on Chinese Wikipedia, 3.84 bytes per token on average; 64% of tokens are single characters) and hides spelling from the model. We ask whether an already-trained 27B subword model can be converted directly into a pure byte-level model (one byte, one token), without a patching structure or a local encoder, while keeping most of its ability. Starting from Qwen3.8-27B (48 Gated DeltaNet layers + 16 full-attention layers), we shrink the vocabulary from 248,320 to 384 entries (the 256 byte symbols already in the BPE vocabulary plus special ids), leave every other weight untouched, and continue training in a two-stage curriculum (encoding first, then reading) on 4.77 GB of supervised bytes: all dialogue/behavioral supervision is generated on-policy by the original model itself (character dictionary, word dictionary, general dialogue, coding sessions), and knowledge reading uses encyclopedia text (54% of supervised bytes). Training takes 178.6 h on 8xH200. On the same GPU and serving stack, the byte model's gap to the original falls within the paired bootstrap interval on MATH-500, HumanEval+, MMLU-Pro and non-thinking GSM8K, and it loses 4-6 points on C-Eval, thinking-mode GSM8K and non-thinking IFEval. Without thinking it leads on every character-level task (CUTE 75.2 -> 84.0, EXECUTE-zho 81.6 -> 93.9, our Chinese character suite 54.4 -> 64.0), but lookup knowledge about Chinese characters such as pronunciation and stroke count drops, and thinking does not recover it. The cost is throughput: per-step speed is identical, but each step yields 3-5x less output; Chinese characters per second is about 1/4 of the original, and prefill at 64K bytes is 6.5x slower. We also document four byte-model failure modes (greedy runaway, sampling breaking UTF-8, ineffective penalty terms on a small vocabulary, repetition) and their fixes.โ–ผ more
โœ‚๏ธ Tokenization & Preprocessing๐Ÿค– Language Models
๐Ÿ“„ arXiv:2611.13568 ยท cs.DS2d ago

Pair-Merge Tokenisation Is Hard to Approximate on Binary Strings and Strongly NP-Hard on Unary Datasets

Kundan Baliga, Aiden Xie, Aditya Byju

๐Ÿ’ฌ 34 pages, 11 figures. Code and certificates: https://doi.org/10.5281/zenodo.24023730

Tokenisers such as Byte-Pair Encoding (BPE) shorten text by repeatedly merging an adjacent pair of symbols into a new one; fewer tokens mean less computation. We ask whether an efficient algorithm can choose $k$ merges that leave a string of length $n$ almost as short as possible; doing nothing is already within a factor $n$. We prove that, unless P = NP, no polynomial-time algorithm comes within a factor $c\,n/\log n$, for some constant $c>0$, already for one binary string and for BPE-style merges that replace every occurrence. The key idea is that $k$ merges form a grammar with $k$ rules: a vertex-cover gap becomes a grammar-size gap, which we amplify with relabelled copies, encode in binary and realise with explicit merges. For merges that may skip occurrences, a simple algorithm achieves $O(n/\log\log n)$, and no Karp reduction can prove hardness beyond order $n/\log n$ unless coNP $\subseteq$ NP/poly. Over a one-letter alphabet, both tokenisation problems left open by Kastreva et al. are strongly NP-complete on datasets with repeated strings.โ–ผ more
โœ‚๏ธ Tokenization & Preprocessing
๐Ÿ“„ arXiv:2611.13564 ยท cs.CL2d ago

A Concept-Based Interpretable Framework for Clinical Text-based Prediction via Token-Concept Attention without Concept Supervision

Jifan Gao, Junjie Hu, John Caskey +6

Objective: Concept-based interpretation has emerged as a promising approach for explaining blackbox models using human-understandable, high-level concepts. However, most existing methods require annotated concept labels to train the model to identify concepts in the input, and obtaining such annotations in clinical text is often expensive. This study aims to enable concept-based interpretation for language models without concept supervision on clinical prediction tasks. Methods: We propose a novel framework that enables concept-based interpretation without concept supervision through a tailored cross-attention bottleneck. Clinical text and the text descriptions of medical concepts are first tokenized and embedded by a pretrained language model. A cross-attention module then estimates the presence of each concept for each text token, producing concept relevance scores that capture how concepts are involved throughout the note. These scores are pooled and used in a linear prediction layer to model clinical outcomes in an interpretable manner. Results: The performance of the proposed framework was compared against blackbox models across two tasks: chest trauma severity stratification using a private dataset and an in-hospital mortality prediction task using the publicly available MIMIC-III dataset. The proposed framework achieved AUROC values within 0.02 of the corresponding blackbox models. The framework also enabled cohort- and patient-level interpretation, capturing the overall concept importance across the cohort and patient-specific concept contributions. Conclusion: Our proposed framework realizes concept-based interpretation without requiring ground-truth concept presence labels. It improves the transparency of clinical text predictions while maintaining strong performance in clinical prediction tasks.โ–ผ more
โœ‚๏ธ Tokenization & Preprocessing๐Ÿค– Language Models