Logo Lanfrica

fgaim/tigrinya-numbers

Domain:

natural language processing

Record type:

software
Creator:
fga
Host:
Python package to convert numbers to Tigrinya words # Tigrinya Number Verbalizer: Convert Numbers to Spoken Words A Python package to convert numbers to spoken Tigrinya words. See the paper **Tigrinya Number Verbalization: Rules, Algorithm, and Implementation** for details. ## Features - **Cardinal numbers**: Convert integers and decimals to words (e.g., 127 → ሓደ ሚእትን ዕስራን ሸውዓተን) - **Ordinal numbers**: 1st-10th with gender support, 11th+ with መበል prefix - **Percentages**: Cardinal + ሚእታዊት suffix (e.g., 40% → ኣርብዓ ሚእታዊት) - **Currency**: Nakfa (ERN), Birr (ETB), Dollar (USD), Euro (EUR) - **Dates**: Read dates with numeric or proper month names (e.g., 24/5 → ግንቦት ዕስራን ኣርባዕተን) - **Time**: Hour, minute, and second verbalization - **Phone numbers**: Pair-wise or single-digit reading ### Functions | Feature | Example Function Call | Example Output | | ------- | --------------------- | -------------- | | Cardinals | `num_to_tigrinya(127)` | ሓደ ሚእትን ዕስራን ሸውዓተን | | Ordinals | `num_to_ordinal(1)` | ቀዳማይ, 25th → መበል ዕስራን ሓሙሽተን | | Currency | `num_to_currency(5.50)` | ሓሙሽተ ናቕፋን ሓምሳ ሳንቲምን | | Dates | `num_to_date(25, 12)` | ታሕሳስ ዕስራን ሓሙሽተን | | Time | `num_to_time(3, 45)` | ሰዓት ሰለስተን ኣርብዓን ሓሙሽተን ደቒቕን | | Phone | `num_to_phone("07123456")` | ዜሮ ሸውዓተ ዓሰርተ ክልተ ሰላሳን ኣርባዕተን ሓምሳን ሽድሽተን | | Percent | `num_to_percent(40.5)` | ኣርብዓ ነጥቢ ሓሙሽተ ሚእታዊት | ## Installation Install package from PyPI: ```bash pip install tigrinya-numbers # or using uv uv pip install tigrinya-numbers ``` Or install from source after cloning the repository: ```bash pip install -e . # or using uv uv sync # then activate the virtual environment to use package ``` ## Usage ### Cardinal Numbers ```python from tigrinya_numbers import num_to_tigrinya # The num_to_tigrinya function is an alias for num_to_cardinal # Basic numbers num_to_tigrinya(7) # → 'ሸውዓተ' num_to_tigrinya(15) # → 'ዓሰርተ ሓሙሽተ' num_to_tigrinya(25) # → 'ዕስራን ሓሙሽተን' num_to_tigrinya(127) # → 'ሓደ ሚእትን ዕስራን ሸውዓተን' # Large numbers num_to_tigrinya(1_234_567) # → 'ሓደ ሚልዮንን ክል …