Metadata-Version: 2.4
Name: indic-itn
Version: 0.2.1
Summary: Inverse Text Normalization (ITN) for Indic languages
License: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: black>=24.0.0; extra == "dev"
Requires-Dist: mypy>=1.9.0; extra == "dev"
Requires-Dist: pre-commit>=3.6.0; extra == "dev"
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
Requires-Dist: ruff>=0.3.0; extra == "dev"
Dynamic: license-file

# indic-itn (v0.2.1)

Inverse Text Normalization (ITN) for Indic languages (Hindi, Telugu, Kannada, etc.).

`indic-itn` converts spoken-form ASR (Automatic Speech Recognition) transcriptions into normalized written representations across **currency, date, decimal, number, OTP, percentage, phone, and time** entities.

---

## Installation

```bash
pip install indic-itn
```

Or install locally in editable mode for development:

```bash
pip install -e ".[dev]"
```

---

## Usage

### 1. Hindi ITN

```python
from indic_itn import HindiITN

itn = HindiITN()

# Numbers & Currency
print(itn.normalize("पाँच लाख साठ हजार रुपये"))
# Output: "₹560000"

# Time & Date
print(itn.normalize("पाँच बजकर तीस मिनट"))
# Output: "5:30"
```

### 2. Telugu ITN

```python
from indic_itn import TeluguITN

itn = TeluguITN()

# Numbers & Currency
print(itn.normalize("రెండు వందల రూపాయలు"))
# Output: "₹200"

# Phone & OTP
print(itn.normalize("నా నంబర్ తొమ్మిది ఎనిమిది ఏడు ఆరు ఐదు నాలుగు మూడు రెండు ఒకటి సున్నా"))
# Output: "నా నంబర్ 9876543210"
```

### 3. Kannada ITN

```python
from indic_itn import KannadaITN

itn = KannadaITN()

# Percentage & Decimal
print(itn.normalize("ಮೂರು ಬಿಂದು ಒಂದು ನಾಲ್ಕು"))
# Output: "3.14"

print(itn.normalize("ಇಪ್ಪತ್ತೈದು ಶೇಕಡಾ"))
# Output: "25%"
```

### 4. Generic Multi-Lingual Factory (`IndicITN`)

```python
from indic_itn import IndicITN

# Dynamically instantiate ITN for any supported language code
hi_itn = IndicITN(lang="hi")
te_itn = IndicITN(lang="te")
kn_itn = IndicITN(lang="kn")
ta_itn = IndicITN(lang="ta")  # Tamil
```

### 5. Checking Supported Languages Programmatically

```python
from indic_itn import IndicITN, get_supported_languages

# Call classmethod on IndicITN
print(IndicITN.get_supported_languages())
# Output: ['hi', 'kn', 'ta', 'te']

# Or call top-level utility function
print(get_supported_languages())
# Output: ['hi', 'kn', 'ta', 'te']
```

---

## Supported Entity Types

| Entity Type | Example Spoken Input | Normalized Output |
| :--- | :--- | :--- |
| **Number** | `"कक्षा दो"` / `"తరగతి రెండు"` / `"ತರಗತಿ ಎರಡು"` | `"कक्षा 2"` / `"తరగతి 2"` / `"ತರಗತಿ 2"` |
| **Currency** | `"दो सौ रुपये"` / `"రెండు వందల రూపాయలు"` / `"ಎರಡು ನೂರು ರೂಪಾಯಿ"` | `"₹200"` |
| **Date** | `"पच्चीस दिसंबर दो हजार पच्चीस"` | `"25 दिसंबर 2025"` |
| **Time** | `"पाँच बजकर तीस मिनट"` / `"ఐదు ಗంటల ముప్పై నిమిషాలు"` | `"5:30"` |
| **Decimal** | `"तौम्मिदि दशमलव पाँच"` / `"మూడు పాయింట్ ఒకటి నాలుగు"` | `"9.5"` / `"3.14"` |
| **Percentage**| `"इरवै आईदु प्रतिशत"` / `"ಇಪ್ಪತ್ತೈದು ಶೇಕಡಾ"` | `"25%"` |
| **Phone** | `"मेरा नंबर नौ आठ सात छह पाँच चार तीन दो एक शून्य"` | `"मेरा नंबर 9876543210"` |
| **OTP** | `"मेरा ओटीपी छह पाँच चार तीन दो एक"` | `"मेरा ओटीपी 654321"` |

---

## Development and Tooling

### Running Tests and Coverage

```bash
pytest --cov=indic_itn --cov-report=term-missing
```

### Code Formatting and Linting

```bash
ruff check .
ruff format --check .
```
