text2num
Parse and convert numbers written in French, Spanish, English, Portuguese, German, Dutch or Italian into their digit representation.
What it is and what it does
text2num is a parser library that recognizes and converts numbers written as natural language words into their integer or decimal digit equivalents. It supports seven languages: Dutch, English, French, German, Italian, Portuguese, and Spanish. The library handles cardinal numbers (e.g., 'ninety-five'), ordinals (e.g., 'fifth'), and decimal numbers (e.g., 'twelve point five'). The implementation is based on a Rust algorithm, providing low resource and energy consumption with small latency, and precompiled wheels are provided so you don't need to compile Rust yourself.
The package offers two main functions: direct conversion of word strings to numbers, and finding and transcribing all numbers within larger text passages. It operates in a relaxed parsing mode by default, tolerating punctuation and spacing variations in the input. There are no external runtime dependencies, making it lightweight and suitable for embedded or resource-constrained environments.
Use it for:
- Convert spoken or transcribed numbers in customer service or voice-to-text workflows into standardized digit format.
- Parse invoice or contract text to extract numerical amounts written in words for data entry or validation.
- Process multilingual documents to normalize number representations for downstream analysis or database storage.
- Build chatbots or voice assistants that need to understand number words in multiple languages.
- Validate or clean datasets containing mixed text and number formats across international sources.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts natural language number words into their digit representations across seven languages, and detects ordinal, cardinal, and decimal numbers in text streams.
Yes. The package is actively maintained, has no known vulnerabilities, supports current Python versions, and solves a specific multilingual parsing problem with zero runtime dependencies. Install friction is moderate but manageable via precompiled wheels. The permissive license and stable API make it suitable for production use.
Install
text2num on PyPI
pip
pip install text2numuv
uv add text2numpoetry
poetry add text2numInstalling text2num
Before you install
Medium install friction due to compiled wheels, but precompiled binaries are provided for Linux, macOS, and Windows across multiple architectures and Python versions (3.8–3.13), making installation straightforward on supported platforms. Repository is actively maintained with recent commits.
License in practice
Permissive license allows use in commercial and open-source projects without restriction.
Quickstart
pip install text2num
from text2num import text2num
result = text2num('ninety-five', 'en')
print(result) # 95
Requires Python 3.8 or later; macOS support begins at Python 3.11.
Verify before relying
- Whether the Rust implementation provides measurable performance gains over the retired 2.X pure-Python version.
- Whether speech-to-text token stream processing is production-ready or experimental.
- Exact license identifier (MIT indicated by classifier but not confirmed in metadata).
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 79 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 685,181/month — #5,355 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: text2num-3.0.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; text2num-3.0.2-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; text2num-3.0.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; text2num-3.0.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl; text2num-3.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; text2num-3.0.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl; text2num-3.0.2-cp310-cp310-musllinux_1_2_aarch64.whl; text2num-3.0.2-cp310-cp310-musllinux_1_2_armv7l.whl; text2num-3.0.2-cp310-cp310-musllinux_1_2_i686.whl; text2num-3.0.2-cp310-cp310-musllinux_1_2_x86_64.whl; text2num-3.0.2-cp310-cp310-win_amd64.whl; text2num-3.0.2-cp311-cp311-macosx_11_0_arm64.whl; text2num-3.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; text2num-3.0.2-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; text2num-3.0.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; text2num-3.0.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl; text2num-3.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; text2num-3.0.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl; text2num-3.0.2-cp311-cp311-musllinux_1_2_aarch64.whl; text2num-3.0.2-cp311-cp311-musllinux_1_2_armv7l.whl
Keywords: French, Spanish, English, Portuguese, German, Italian, Dutch, NLP, words-to-numbers
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
text2digitsConverts written-out number words in text to…
permissive · top 15,000 on PyPI
num2wordsConverts numbers to their word representations…
copyleft · top 5,000 on PyPI
word2numberConverts written-out number words (like "twenty…
permissive · top 5,000 on PyPI
number-parserConverts numbers written in natural language…
permissive · top 15,000 on PyPI
unicode-rbnfConverts numbers to spelled-out text in…
permissive · top 15,000 on PyPI
indic-numtowordsConverts non-negative integers to their word…
permissive · top 15,000 on PyPI
recognizers-text-numberRecognizes and extracts numeric entities…
permissive · top 15,000 on PyPI
recognizers-textRecognizes and extracts entities like numbers,…
permissive · top 15,000 on PyPI
bpembBPEmb provides pre-trained subword embeddings…
permissive · top 15,000 on PyPI
indic-nlp-libraryIndic NLP Library provides text processing and…
permissive · top 15,000 on PyPI