lezgi-numbers


Namelezgi-numbers JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/LekiTech/lezgi-numbers-python
SummaryA Python package for converting numbers to Lezgi numerals and back.
upload_time2024-12-04 20:01:43
maintainerNone
docs_urlNone
authorKamran Tadzjibov
requires_python>=3.6
licenseNone
keywords lezgi numbers conversion localization
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Lezgi Numbers Python Package

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

## Table of Contents

- [Introduction](#introduction)
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
  - [Converting Numbers to Lezgi Numerals](#converting-numbers-to-lezgi-numerals)
  - [Converting Lezgi Numerals to Numbers](#converting-lezgi-numerals-to-numbers)
- [Examples](#examples)
- [Testing](#testing)

## 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 (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, clone this repository and install it using `pip` in editable mode.

```bash
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:

```python
from src.numToLezgi import numToLezgi
from src.lezgiToNum import lezgiToNum
```

### Converting Numbers to Lezgi Numerals
```python
number = 1986
lezgi_numeral = numToLezgi(number)
print(lezgi_numeral)  # Output: 'агъзурни кIуьд вишни кьудкъанни ругуд'
```

### Converting Lezgi Numerals to Numbers

```python
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

```python
from src.numToLezgi 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

```python
from src.lezgiToNum import lezgiToNum

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

### Example 3: Handling Large Numbers

```python
from src.numToLezgi import numToLezgi
from src.lezgiToNum import 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

```bash
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.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/LekiTech/lezgi-numbers-python",
    "name": "lezgi-numbers",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "lezgi numbers conversion localization",
    "author": "Kamran Tadzjibov",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/c2/88/430e1045b0784ae429c27fd1fa5313e74f1bbb67288795749da24abe9b73/lezgi_numbers-0.1.0.tar.gz",
    "platform": null,
    "description": "# Lezgi Numbers Python Package\n\n**A Python package for converting numbers to Lezgi numerals and back.**\n\n## Table of Contents\n\n- [Introduction](#introduction)\n- [Features](#features)\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Converting Numbers to Lezgi Numerals](#converting-numbers-to-lezgi-numerals)\n  - [Converting Lezgi Numerals to Numbers](#converting-lezgi-numerals-to-numbers)\n- [Examples](#examples)\n- [Testing](#testing)\n\n## Introduction\n\nThis 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 (the original language of the package).\n\nThe Lezgi language is a Northeast Caucasian language spoken by the Lezgin people in southern Dagestan and northern Azerbaijan.\n\n## Features\n\n- Number to Lezgi Numeral Conversion: Convert integers to Lezgi text representation.\n- Lezgi Numeral to Number Conversion: Convert Lezgi numerals back to integers.\n- Supports Negative Numbers: Handles both positive and negative integers.\n- Large Number Support: Works with very large numbers up to nonillion (1e30).\n- Unit Tests Included: Comprehensive tests to ensure correctness.\n\n## Installation\n\nTo install the package, clone this repository and install it using `pip` in editable mode.\n\n```bash\ngit clone https://github.com/LekiTech/lezgi-numbers-py.git\ncd lezgi-numbers-py\npip install -e .\n```\n\n## Usage\nThe package provides two main functions:\n\n- `numToLezgi(num: int) -> str`: Converts an integer to its Lezgi text representation.\n- `lezgiToNum(lezgi_num_str: str) -> int`: Converts a Lezgi numeral string to an integer.\n\nFirst, import the necessary functions:\n\n```python\nfrom src.numToLezgi import numToLezgi\nfrom src.lezgiToNum import lezgiToNum\n```\n\n### Converting Numbers to Lezgi Numerals\n```python\nnumber = 1986\nlezgi_numeral = numToLezgi(number)\nprint(lezgi_numeral)  # Output: '\u0430\u0433\u044a\u0437\u0443\u0440\u043d\u0438 \u043aI\u0443\u044c\u0434 \u0432\u0438\u0448\u043d\u0438 \u043a\u044c\u0443\u0434\u043a\u044a\u0430\u043d\u043d\u0438 \u0440\u0443\u0433\u0443\u0434'\n```\n\n### Converting Lezgi Numerals to Numbers\n\n```python\nlezgi_num_str = '\u043a\u044c\u0432\u0435 \u0430\u0433\u044a\u0437\u0443\u0440\u043d\u0438 \u043a\u044a\u0430\u043d\u043d\u0438 \u043a\u044c\u0443\u0434'\nnumber = lezgiToNum(lezgi_num_str)\nprint(number)  # Output: 2024\n```\n\n## Examples\n\nHere are additional examples demonstrating the usage of the package.\n\n### Example 1: Converting Number to Lezgi Numeral\n\n```python\nfrom src.numToLezgi import numToLezgi\n\nprint(numToLezgi(700))          # Output: '\u0438\u0440\u0438\u0434 \u0432\u0438\u0448'\nprint(numToLezgi(1001))         # Output: '\u0430\u0433\u044a\u0437\u0443\u0440\u043d\u0438 \u0441\u0430\u0434'\nprint(numToLezgi(-102))         # Output: '\u043c\u0438\u043d\u0443\u0441 \u0432\u0438\u0448\u043d\u0438 \u043a\u044c\u0432\u0435\u0434'\nprint(numToLezgi(2024))         # Output: '\u043a\u044c\u0432\u0435 \u0430\u0433\u044a\u0437\u0443\u0440\u043d\u0438 \u043a\u044a\u0430\u043d\u043d\u0438 \u043a\u044c\u0443\u0434'\n```\n\n### Example 2: Converting Lezgi Numeral to Number\n\n```python\nfrom src.lezgiToNum import lezgiToNum\n\nprint(lezgiToNum('\u0432\u0438\u0448\u043d\u0438 \u043a\u044c\u0432\u0435\u0434'))           # Output: 102\nprint(lezgiToNum('\u043c\u0438\u043d\u0443\u0441 \u0432\u0438\u0448\u043d\u0438 \u043a\u044c\u0432\u0435\u0434'))     # Output: -102\nprint(lezgiToNum('\u043a\u044c\u0432\u0435 \u0430\u0433\u044a\u0437\u0443\u0440\u043d\u0438 \u043a\u044a\u0430\u043d\u043d\u0438 \u043a\u044c\u0443\u0434'))  # Output: 2024\n```\n\n### Example 3: Handling Large Numbers\n\n```python\nfrom src.numToLezgi import numToLezgi\nfrom src.lezgiToNum import lezgiToNum\n\nlarge_number = 9007199254740991\nlezgi_numeral = numToLezgi(large_number)\nprint(lezgi_numeral)\n# Output: '\u043aI\u0443\u044c\u0434 \u043a\u0432\u0430\u0434\u0440\u0438\u043b\u043b\u0438\u043e\u043d\u043d\u0438 \u0438\u0440\u0438\u0434 \u0442\u0440\u0438\u043b\u043b\u0438\u043e\u043d\u043d\u0438 \u0432\u0438\u0448\u043d\u0438 \u043a\u044c\u0443\u0434\u043a\u044a\u0430\u043d\u043d\u0438 \u0446I\u0435\u043aI\u0443\u044c\u0434 \u043c\u0438\u043b\u043b\u0438\u0430\u0440\u0434\u043d\u0438 \u043a\u044c\u0432\u0435 \u0432\u0438\u0448\u043d\u0438 \u044f\u0445\u0446I\u0443\u0440\u043d\u0438 \u0446I\u0438\u043a\u044c\u0443\u0434 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043d\u0438 \u0438\u0440\u0438\u0434 \u0432\u0438\u0448\u043d\u0438 \u044f\u0445\u0446I\u0443\u0440 \u0430\u0433\u044a\u0437\u0443\u0440\u043d\u0438 \u043aI\u0443\u044c\u0434 \u0432\u0438\u0448\u043d\u0438 \u043a\u044c\u0443\u0434\u043a\u044a\u0430\u043d\u043d\u0438 \u0446I\u0443\u0441\u0430\u0434'\n\nconverted_back = lezgiToNum(lezgi_numeral)\nprint(converted_back)  # Output: 9007199254740991\n```\n\n## Testing\n\nThe package includes unit tests to verify the correctness of the conversion functions.\n\n### Running Tests\n\n```bash\npython -m unittest discover -s tests  \n```\n\n### Test Coverage\n\nThe tests cover:\n\n- Correct conversion of numbers to Lezgi numerals.\n- Correct conversion of Lezgi numerals to numbers.\n- Handling of invalid inputs (e.g., non-integer numbers, invalid strings).\n- Edge cases, including large numbers and negative numbers.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python package for converting numbers to Lezgi numerals and back.",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/LekiTech/lezgi-numbers-python"
    },
    "split_keywords": [
        "lezgi",
        "numbers",
        "conversion",
        "localization"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f25f3e4c093d7a910e38e961c0ed0078c1f866f64d3ccd909450c105652905ed",
                "md5": "0a9215522b5ea4ede1b447cd6fe6b9ee",
                "sha256": "a98d6198de87caa0edad60525577535508a576ca004a1c61ba06a4f6c3097c53"
            },
            "downloads": -1,
            "filename": "lezgi_numbers-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0a9215522b5ea4ede1b447cd6fe6b9ee",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 11040,
            "upload_time": "2024-12-04T20:01:41",
            "upload_time_iso_8601": "2024-12-04T20:01:41.257794Z",
            "url": "https://files.pythonhosted.org/packages/f2/5f/3e4c093d7a910e38e961c0ed0078c1f866f64d3ccd909450c105652905ed/lezgi_numbers-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c288430e1045b0784ae429c27fd1fa5313e74f1bbb67288795749da24abe9b73",
                "md5": "8fa24d24639845be7e822990f6bb2f63",
                "sha256": "c64501ab5ab743c5800fa94370f3bbde8685984e782c4835a0e8c423bb7a1dd6"
            },
            "downloads": -1,
            "filename": "lezgi_numbers-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "8fa24d24639845be7e822990f6bb2f63",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 10634,
            "upload_time": "2024-12-04T20:01:43",
            "upload_time_iso_8601": "2024-12-04T20:01:43.049554Z",
            "url": "https://files.pythonhosted.org/packages/c2/88/430e1045b0784ae429c27fd1fa5313e74f1bbb67288795749da24abe9b73/lezgi_numbers-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-04 20:01:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "LekiTech",
    "github_project": "lezgi-numbers-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "lezgi-numbers"
}
        
Elapsed time: 1.03329s