A Pashto-native BPE tokenizer trained on 24 million unique sentences from the
PashtoCorp
corpus
(1.25 billion words). Provided in two formats: a HuggingFace-native tokenizer
(load with
AutoTokenizer
) and a SentencePiece model for broader compatibility.
Performance
Metric
Value
Vocabulary size
32,000
Pashto BPE fertility
1.2516 tokens/word
XLM-R fertility (Pashto)
1.5018 tokens/word
Token reduction vs XLM-R
16.67% fewer tokens
Training sentences
24,035,371
Fertility measures average tokens per whitespace-split word — lower means more
efficient encoding. At 1.2516 tokens/word, this tokenizer uses 16.67%
fewer tokens than XLM-R's multilingual tokenizer on Pashto text, which directly
reduces compute cost for any transformer model trained with it.
SentencePiece with byte fallback (handles any character)
# The model uses byte_fallback=True, so any OOV character# is safely encoded as UTF-8 bytes rather than [UNK]
text_with_numbers = "د ۲۰۲۶ کال راپور"print(sp.EncodeAsPieces(text_with_numbers))
Measuring fertility on your own text
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("ihanif/pashto-tokenizer")
deffertility(text):
words = text.split()
tokens = tokenizer.tokenize(text)
returnlen(tokens) / len(words) if words else0print(fertility("د افغانستان د ملت د سولې غوښتنه"))
# → ~1.25 tokens/word
@misc{rahman2026pashtocorp,
title = {PashtoCorp: A 1.25B-Word Corpus, Evaluation Suite, and
Reproducible Pipeline for Low-Resource Language Development},
author = {Rahman, Hanif},
year = {2026},
howpublished = {\url{https://huggingface.co/ihanif/pashto-tokenizer}},
}
Runs of ihanif pashto-tokenizer on huggingface.co
0
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs
More Information About pashto-tokenizer huggingface.co Model
pashto-tokenizer huggingface.co is an AI model on huggingface.co that provides pashto-tokenizer's model effect (), which can be used instantly with this ihanif pashto-tokenizer model. huggingface.co supports a free trial of the pashto-tokenizer model, and also provides paid use of the pashto-tokenizer. Support call pashto-tokenizer model through api, including Node.js, Python, http.
pashto-tokenizer huggingface.co is an online trial and call api platform, which integrates pashto-tokenizer's modeling effects, including api services, and provides a free online trial of pashto-tokenizer, you can try pashto-tokenizer online for free by clicking the link below.
ihanif pashto-tokenizer online free url in huggingface.co:
pashto-tokenizer is an open source model from GitHub that offers a free installation service, and any user can find pashto-tokenizer on GitHub to install. At the same time, huggingface.co provides the effect of pashto-tokenizer install, users can directly use pashto-tokenizer installed effect in huggingface.co for debugging and trial. It also supports api for free installation.