Metadata-Version: 2.4
Name: geez
Version: 1.1.0
Summary: A Python library to convert numbers to their Ge'ez number representation
Home-page: https://github.com/kidusmakonnen/geez-py
Author: Kidus Makonnen
License: MIT
Project-URL: Homepage, https://github.com/kidusmakonnen/geez-py
Project-URL: Bug Tracker, https://github.com/kidusmakonnen/geez-py/issues
Project-URL: Source Code, https://github.com/kidusmakonnen/geez-py
Keywords: geez,ethiopian,numerals,conversion
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: Linguistic
Classifier: Topic :: Utilities
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# Ge'ez Utils (Python)

[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)

A Python library to convert numbers to their [Ge'ez number](https://en.wikipedia.org/wiki/Ge%CA%BDez_script#Numerals "Ge'ez number") representation and vice versa.

Ported from the original Java implementation: [kidusmakonnen/geez](https://github.com/kidusmakonnen/geez)

## Features

- Convert Arabic numerals to Ge'ez numerals
- Convert Ge'ez numerals back to Arabic numerals
- Support for large numbers
- Comprehensive test suite
- Compatible with Python 3.6+

## Installation

You can install this package using pip:

```bash
pip install geez
```

Or install from source:

```bash
git clone https://github.com/kidusmakonnen/geez-py.git
cd geez-py
pip install .
```

## Usage

### Converting Arabic Numerals to Ge'ez

```python
from geez import to_geez

# Convert number to Ge'ez (string input)
result = to_geez("123")
print(result)  # Output: ፻፳፫

# Convert number to Ge'ez (integer input)
result = to_geez(123)
print(result)  # Output: ፻፳፫

# Convert large numbers
result = to_geez(1000000)
print(result)  # Output: ፻፼
```

### Converting Ge'ez Numerals to Arabic

```python
from geez import from_geez

# Convert Ge'ez to number
result = from_geez("፻፳፫")
print(result)  # Output: "123"

# Convert large Ge'ez numbers
result = from_geez("፻፼")
print(result)  # Output: "1000000"
```

### Error Handling

The library raises `ValueError` for invalid inputs:

```python
from geez import to_geez, from_geez

try:
    # Invalid input (negative number)
    to_geez("-5")
except ValueError as e:
    print(e)  # Output: Invalid input.

try:
    # Invalid Ge'ez number
    from_geez("፩፩")
except ValueError as e:
    print(e)  # Output: Invalid Ge'ez number.
```

## Ge'ez Numerals Reference

| Arabic | Ge'ez | | Arabic | Ge'ez |
|--------|-------|-|--------|-------|
| 1      | ፩     | | 10     | ፲     |
| 2      | ፪     | | 20     | ፳     |
| 3      | ፫     | | 30     | ፴     |
| 4      | ፬     | | 40     | ፵     |
| 5      | ፭     | | 50     | ፶     |
| 6      | ፮     | | 60     | ፷     |
| 7      | ፯     | | 70     | ፸     |
| 8      | ፰     | | 80     | ፹     |
| 9      | ፱     | | 90     | ፺     |
| 100    | ፻     | | 10000  | ፼     |

## Development

### Running Tests

```bash
# Install development dependencies
pip install -e .

# Run tests
python -m unittest discover tests

# Or run specific test
python -m unittest tests.test_geez_util
```

### Building the Package

```bash
# Install build dependencies
pip install build

# Build the package
python -m build
```

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## API Reference

### Functions

#### `to_geez(num: Union[str, int]) -> str`

Convert an Arabic numeral to Ge'ez numerals.

**Parameters:**
- `num` (str or int): String or integer representation of a number greater than 0

**Returns:**
- `str`: The converted Ge'ez number as a string

**Raises:**
- `ValueError`: If the input is invalid (not a positive number)

#### `from_geez(geez_number: str) -> str`

Convert Ge'ez numerals back into Arabic numerals.

**Parameters:**
- `geez_number` (str): The Ge'ez number string

**Returns:**
- `str`: The converted number as a string

**Raises:**
- `ValueError`: If the input is an invalid Ge'ez number
