Skip to main content

XNum: Universal Numeral System Converter

Project description

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

Installation

PyPI

Source code

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
  • Persian
  • Hindi
  • Arabic-Indic
  • Bengali
  • Thai
  • Khmer
  • Burmese
  • Tibetan
  • Gujarati
  • Odia

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

Discord Channel

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

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.3 - 2025-08-05

Added

  • Tibetan numeral system
  • Gujarati numeral system
  • Odia numeral system

Changed

  • README.md updated

0.2 - 2025-07-28

Added

  • Thai numeral system
  • Khmer numeral system
  • Burmese numeral system
  • Logo

Changed

  • Test system modified
  • target parameter bug fixed
  • README.md updated

0.1 - 2025-07-20

Added

  • English numeral system
  • Persian numeral system
  • Hindi numeral system
  • Arabic-Indic numeral system
  • Bengali numeral system

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xnum-0.3.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xnum-0.3-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file xnum-0.3.tar.gz.

File metadata

  • Download URL: xnum-0.3.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for xnum-0.3.tar.gz
Algorithm Hash digest
SHA256 167d3522bac3917e507191c26c38189b04bd7e770f3958d8a8cdc1ba7a9348e4
MD5 a5dc16a42eb3c09da8a2bed4adb3fa20
BLAKE2b-256 b17fc9a25567335ac25be8857a99a8108f61975083ea6b46030b6a6c4176bf3f

See more details on using hashes here.

File details

Details for the file xnum-0.3-py3-none-any.whl.

File metadata

  • Download URL: xnum-0.3-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for xnum-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6f410436e46786be97ae3afed07ab7c1117fa8fc4e13ed24a2fdfcde92a2d41a
MD5 9b96da28f2a0c5f6509f80efbe6a3cf5
BLAKE2b-256 8efd0752660d237dbc862d0e67dc449a18c47d3275f5c5e0c595764708cc71c3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page