Skip to main content

A Python package for converting numbers to Lezgi numerals and back.

Project description

Lezgi Numbers Python Package

A Python package for converting numbers to Lezgi numerals and back.

Table of Contents

Introduction

This Python package provides functions to convert integer numbers to their textual representation in the Lezgi language and vice versa. It supports numbers up to 9007199254740991 and down to -9007199254740991, which are the maximum safe integers in JavaScript/Typescript (the original language of the package).

The Lezgi language is a Northeast Caucasian language spoken by the Lezgin people in southern Dagestan and northern Azerbaijan.

Features

  • Number to Lezgi Numeral Conversion: Convert integers to Lezgi text representation.
  • Lezgi Numeral to Number Conversion: Convert Lezgi numerals back to integers.
  • Supports Negative Numbers: Handles both positive and negative integers.
  • Large Number Support: Works with very large numbers up to nonillion (1e30).
  • Unit Tests Included: Comprehensive tests to ensure correctness.

Installation

To install the package, you can either download it from pypi:

pip install lezgi-numbers

Or clone this repository and install it using pip in editable mode.

git clone https://github.com/LekiTech/lezgi-numbers-py.git
cd lezgi-numbers-py
pip install -e .

Usage

The package provides two main functions:

  • numToLezgi(num: int) -> str: Converts an integer to its Lezgi text representation.
  • lezgiToNum(lezgi_num_str: str) -> int: Converts a Lezgi numeral string to an integer.

First, import the necessary functions:

from lezgi_numbers import numToLezgi, lezgiToNum

Converting Numbers to Lezgi Numerals

number = 1986
lezgi_numeral = numToLezgi(number)
print(lezgi_numeral)  # Output: 'агъзурни кIуьд вишни кьудкъанни ругуд'

Converting Lezgi Numerals to Numbers

lezgi_num_str = 'кьве агъзурни къанни кьуд'
number = lezgiToNum(lezgi_num_str)
print(number)  # Output: 2024

Examples

Here are additional examples demonstrating the usage of the package.

Example 1: Converting Number to Lezgi Numeral

from lezgi_numbers import numToLezgi

print(numToLezgi(700))          # Output: 'ирид виш'
print(numToLezgi(1001))         # Output: 'агъзурни сад'
print(numToLezgi(-102))         # Output: 'минус вишни кьвед'
print(numToLezgi(2024))         # Output: 'кьве агъзурни къанни кьуд'

Example 2: Converting Lezgi Numeral to Number

from lezgi_numbers import lezgiToNum

print(lezgiToNum('вишни кьвед'))           # Output: 102
print(lezgiToNum('минус вишни кьвед'))     # Output: -102
print(lezgiToNum('кьве агъзурни къанни кьуд'))  # Output: 2024

Example 3: Handling Large Numbers

from lezgi_numbers import numToLezgi, lezgiToNum

large_number = 9007199254740991
lezgi_numeral = numToLezgi(large_number)
print(lezgi_numeral)
# Output: 'кIуьд квадриллионни ирид триллионни вишни кьудкъанни цIекIуьд миллиардни кьве вишни яхцIурни цIикьуд миллионни ирид вишни яхцIур агъзурни кIуьд вишни кьудкъанни цIусад'

converted_back = lezgiToNum(lezgi_numeral)
print(converted_back)  # Output: 9007199254740991

Testing

The package includes unit tests to verify the correctness of the conversion functions.

Running Tests

python -m unittest discover -s tests  

Test Coverage

The tests cover:

  • Correct conversion of numbers to Lezgi numerals.
  • Correct conversion of Lezgi numerals to numbers.
  • Handling of invalid inputs (e.g., non-integer numbers, invalid strings).
  • Edge cases, including large numbers and negative numbers.

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

lezgi_numbers-0.1.1.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

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

lezgi_numbers-0.1.1-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file lezgi_numbers-0.1.1.tar.gz.

File metadata

  • Download URL: lezgi_numbers-0.1.1.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for lezgi_numbers-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a9adc6098c400de5366f0f4fd163568a4804f3aebc5e4d6884799dbc1aae4881
MD5 475d7ab5af6fec001594236c3a3032bf
BLAKE2b-256 db894b6c866d61dec9820a2a1f955285c64f42ed3750c4f05180d6e4b85ebd38

See more details on using hashes here.

File details

Details for the file lezgi_numbers-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: lezgi_numbers-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for lezgi_numbers-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c394baaa56d73568f1e04abdd77df19ca2794d7736b22f84c27b1a7faa833245
MD5 d134ffee84bc412911b563722ac9808d
BLAKE2b-256 346c6b62fe5f1cf7513fd8931c5776629499122386589a64d5b2db5a6ad49904

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