https://github.com/openscilab/xnum
XNum: Universal Numeral System Converter
https://github.com/openscilab/xnum
converter number numbers numeral numeral-systems python
Last synced: 5 months ago
JSON representation
XNum: Universal Numeral System Converter
- Host: GitHub
- URL: https://github.com/openscilab/xnum
- Owner: openscilab
- License: mit
- Created: 2025-07-01T22:11:35.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2026-01-02T01:23:36.000Z (5 months ago)
- Last Synced: 2026-01-02T22:41:54.902Z (5 months ago)
- Topics: converter, number, numbers, numeral, numeral-systems, python
- Language: Python
- Homepage:
- Size: 816 KB
- Stars: 26
- Watchers: 0
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: SECURITY.md
- Authors: AUTHORS.md
Awesome Lists containing this project
README
----------
## 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.
Branch
main
dev
CI
## Installation
### PyPI
- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
- Run `pip install xnum==1.3`
### Source code
- Download [Version 1.3](https://github.com/openscilab/xnum/archive/v1.3.zip) or [Latest Source](https://github.com/openscilab/xnum/archive/dev.zip)
- Run `pip install .`
## Usage
```pycon
>>> from xnum import convert, NumeralSystem
>>> print(convert("۱۲۳ apples & ꘤꘥꘦ cars", target=NumeralSystem.ENGLISH))
123 apples & 456 cars
>>> print(convert("۱۲۳ and 456", source=NumeralSystem.PERSIAN, target=NumeralSystem.HINDI))
१२३ and 456
```
ℹ️ 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
- Circled
- Dingbat Circled Sans-Serif
- Dingbat Negative Circled Sans-Serif
- Keycap
- Emoji
- Full Stop
- Comma
- Segmented
- Persian
- Hindi
- Arabic-Indic
- Bengali
- Thai
- Khmer
- Myanmar
- 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
- Dives Akuru
- Modi
- Takri
- Newa
- Tirhuta
- Sharada
- Khudawadi
- Chakma
- Sora Sompeng
- Hanifi Rohingya
- Osmanya
- Meetei Mayek
- Kayah Li
- Gunjala Gondi
- Masaram Gondi
- Mro
- Wancho
- Adlam
- Tai Tham Hora
- Tai Tham Tham
- Nyiakeng Puachue Hmong
- Malayalam
- Brahmi
- Myanmar Tai Laing
## Issues & bug reports
Just fill an issue and describe it. We'll check it ASAP! or send an email to [xnum@openscilab.com](mailto:xnum@openscilab.com "xnum@openscilab.com").
- Please complete the issue template
You can also join our discord server
## References
1- Unicode - Compart
2- SYMBL (◕‿◕) Symbols, Emojis, Characters, Scripts, Alphabets, Hieroglyphs and the entire Unicode
3- 📙 Emojipedia — 😃 Home of Emoji Meanings 💁👌🎍😍
## 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 ;-) .
