bpemb
Byte-pair embeddings in 275 languages
What it is and what it does
BPEmb is a collection of pre-trained subword embeddings covering 275 languages, built on Wikipedia using Byte-Pair Encoding (BPE). It wraps gensim's KeyedVectors to provide both subword tokenization and embedding vectors for use in neural NLP pipelines.
The package serves two main purposes: splitting text into subwords according to a learned vocabulary (with configurable vocabulary sizes from 1000 to 200000 tokens), and providing dense vector representations for those subwords. You load a language-specific model, encode text into subword tokens or token IDs, and either retrieve embeddings directly or use the built-in embed method. Models and embeddings download automatically on first use.
Use it for:
- Tokenize text into subwords for morphologically rich or low-resource languages where word-level tokenization is insufficient.
- Initialize neural sequence models with pre-trained multilingual embeddings without training your own.
- Build cross-lingual NLP systems that share a common subword representation across languages.
- Experiment with different vocabulary sizes to balance granularity and sparsity for a specific language.
- Embed text fragments for similarity search or clustering in languages beyond English.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
BPEmb provides pre-trained subword embeddings in 275 languages based on Byte-Pair Encoding, enabling subword segmentation and embedding lookup for neural NLP models.
Yes, if you need multilingual subword embeddings and can accept a dormant package. The low install friction, permissive license, and broad language coverage make it useful for research and prototyping. However, the 682-day gap since the last release means no bug fixes or updates are forthcoming; verify that the remote model repository remains accessible before relying on it in production.
Install
bpemb on PyPI
pip
pip install bpembuv
uv add bpembpoetry
poetry add bpembInstalling bpemb
Before you install
Low install friction with a pure Python wheel and five common dependencies (gensim, numpy, requests, sentencepiece, tqdm). The package is dormant—last release 682 days ago—so expect no active maintenance or updates.
License in practice
MIT license is permissive; you can use BPEmb freely in commercial and proprietary projects with minimal restrictions.
Quickstart
pip install bpemb
from bpemb import BPEmb
bpemb_en = BPEmb(lang="en", dim=50)
print(bpemb_en.encode("Stratford"))
# Models and embeddings download automatically on first use
Models and embeddings download automatically from nlp.h-its.org on first use; requires internet access and disk space for language-specific files.
Verify before relying
- Whether the remote model repository (nlp.h-its.org) remains stable and available long-term given the package's dormant status.
- Performance characteristics when working with very large texts or batch processing across many languages.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — gensim, numpy, requests, sentencepiece, tqdm |
| Maintenance | dormant — 682 days since the last release |
| First released | |
| Downloads | 124,620/month — #11,860 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: bpemb-0.3.6-py3-none-any.whl
Tags
More Linguistic packages
Detects and normalizes text encoding from…
permissive · top 100 on PyPI
tiktokentiktoken is a fast BPE tokenizer that converts…
permissive · top 1,000 on PyPI
chardetDetects character encoding and language in byte…
permissive · top 1,000 on PyPI
text-unidecodeConverts Unicode text to ASCII by…
copyleft · top 1,000 on PyPI
larkLark is a parsing library that builds abstract…
permissive · top 1,000 on PyPI
tree-sitterPython bindings to the tree-sitter parsing…
permissive · top 1,000 on PyPI
curated-tokenizersProvides BPE, Byte BPE, Unigram, and Wordpiece…
permissive · top 5,000 on PyPI
jieba3kPerforms Chinese word segmentation, breaking…
unclear · top 15,000 on PyPI
jiebaJieba segments Chinese text into words using…
permissive · top 5,000 on PyPI
num2wordsConverts numbers to their word representations…
copyleft · top 5,000 on PyPI
floretfloret trains compact word embeddings using…
permissive · top 15,000 on PyPI
spacy-pkusegChinese word segmentation for spaCy with…
permissive · top 15,000 on PyPI
model2vecModel2Vec converts sentence transformers into…
permissive · top 5,000 on PyPI
minisbdDetects sentence boundaries in text across many…
agpl · top 15,000 on PyPI
text2numConverts natural language number words into…
permissive · top 15,000 on PyPI
sentence-transformersComputes embeddings and reranking scores for…
permissive · top 1,000 on PyPI