An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          


XNum Logo

XNum: Universal Numeral System Converter




PyPI version
built with Python3

GitHub repo size
Discord Channel

----------

## 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
CodeFactor

## 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


Discord Channel

## 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 ;-) .

XNum Donation