XNum: Universal Numeral System Converter
Project description
Overview
XNum is a simple and lightweight Python library that helps you convert digits between different numeral systems — like English, Persian, Hindi, Arabic-Indic, Bengali, and more. It can automatically detect mixed numeral formats in a piece of text and convert only the numbers, leaving the rest untouched. Whether you're building multilingual apps or processing localized data, XNum makes it easy to handle numbers across different languages with a clean and easy-to-use API.
| PyPI Counter |
|
| Github Stars |
|
| Branch | main | dev |
| CI |
|
|
| Code Quality |
Installation
PyPI
- Check Python Packaging User Guide
- Run
pip install xnum==0.8
Source code
- Download Version 0.8 or Latest Source
- Run
pip install .
Usage
>>> from xnum import convert, NumeralSystem
>>> print(convert("۱۲۳ apples & ٤٥۶ cars", target=NumeralSystem.ENGLISH))
123 apples & 456 cars
>>> print(convert("۱۲۳ and ٤٥٦", source=NumeralSystem.PERSIAN, target=NumeralSystem.HINDI))
१२३ and ٤٥۶
ℹ️ By default, the source parameter is set to NumeralSystem.AUTO, which automatically detects the numeral system
Supported numeral systems
- English
- Standard
- Fullwidth
- Subscript
- Superscript
- Double-Struck
- Bold
- Monospace
- Sans-Serif
- Sans-Serif Bold
- Persian
- Hindi
- Arabic-Indic
- Bengali
- Thai
- Khmer
- Burmese
- Tibetan
- Gujarati
- Odia
- Telugu
- Kannada
- Gurmukhi
- Lao
- Nko
- Mongolian
- Sinhala Lith
- Myanmar Shan
- Limbu
- Vai
- Ol Chiki
- Balinese
- New Tai Lue
- Saurashtra
- Javanese
- Cham
- Lepcha
- Sundanese
Issues & bug reports
Just fill an issue and describe it. We'll check it ASAP! or send an email to xnum@openscilab.com.
- Please complete the issue template
You can also join our discord server
Show your support
Star this repo
Give a ⭐️ if this project helped you!
Donate to our project
If you do like our project and we hope that you do, can you please support us? Our project is not and is never going to be working for profit. We need the money just so we can continue doing what we do ;-) .
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
Unreleased
0.8 - 2025-09-28
Added
- Vai numeral system
- Ol Chiki numeral system
- Balinese numeral system
- New Tai Lue numeral system
- Saurashtra numeral system
- Javanese numeral system
- Cham numeral system
- Lepcha numeral system
- Sundanese numeral system
Changed
- Test system modified
0.7 - 2025-09-17
Added
- Nko numeral system
- Mongolian numeral system
- Sinhala lith numeral system
- Myanmar shan numeral system
- Limbu numeral system
Changed
- Test system modified
0.6 - 2025-09-05
Added
- English double-struck mode
- English bold mode
- English monospace mode
- English sans-serif mode
- English sans-serif bold mode
Changed
README.mdupdated- Test system modified
0.5 - 2025-09-01
Added
- Lao numeral system
- English fullwidth mode
- English subscript mode
- English superscript mode
Changed
- Test system modified
README.mdupdated
0.4 - 2025-08-18
Added
- Gurmukhi numeral system
- Kannada numeral system
- Telugu numeral system
Changed
- Test system modified
README.mdupdated
0.3 - 2025-08-05
Added
- Tibetan numeral system
- Gujarati numeral system
- Odia numeral system
Changed
README.mdupdated
0.2 - 2025-07-28
Added
- Thai numeral system
- Khmer numeral system
- Burmese numeral system
- Logo
Changed
- Test system modified
targetparameter bug fixedREADME.mdupdated
0.1 - 2025-07-20
Added
- English numeral system
- Persian numeral system
- Hindi numeral system
- Arabic-Indic numeral system
- Bengali numeral system
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xnum-0.8.tar.gz.
File metadata
- Download URL: xnum-0.8.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
510e6b09c1b99523941535b00e49cedf6a42c7682ad55466451d8fac77a4bc5c
|
|
| MD5 |
2561a479e4f25f5e68920ce14cc01115
|
|
| BLAKE2b-256 |
eab88a6f5ff48ede1ab958d4b3293d55c9c3f2df671d39cebac97b0e0210f510
|
File details
Details for the file xnum-0.8-py3-none-any.whl.
File metadata
- Download URL: xnum-0.8-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27c72bcece2bf35a842e593d212026c6a593afbbdcbe1f48732c0d82f27a696c
|
|
| MD5 |
6a30638ede418e56b9601f1f5b84cc30
|
|
| BLAKE2b-256 |
08f5bb54e730eb541c788431f0ab4c7e0186e9725be6fe636f3744e97fdd5431
|