Inverse Text Normalization (ITN) for Indic languages
Project description
indic-itn (v0.2.0)
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
pip install indic-itn
Or install locally in editable mode for development:
pip install -e ".[dev]"
Usage
1. Hindi ITN
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
from indic_itn import TeluguITN
itn = TeluguITN()
# Numbers & Currency
print(itn.normalize("రెండు వందల రూపాయలు"))
# Output: "₹200"
# Phone & OTP
print(itn.normalize("నా నంబర్ తొమ్మిది ఎనిమిది ఏడు ఆరు ఐదు నాలుగు మూడు రెండు ఒకటి సున్నా"))
# Output: "నా నంబర్ 9876543210"
3. Kannada ITN
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)
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
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
pytest --cov=indic_itn --cov-report=term-missing
Code Formatting and Linting
ruff check .
ruff format --check .
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file indic_itn-0.2.0.tar.gz.
File metadata
- Download URL: indic_itn-0.2.0.tar.gz
- Upload date:
- Size: 39.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7e58f4c38214693e23f67527a6ec3608ab2a778dbfd2ea059524b447be02ac4
|
|
| MD5 |
9a6a7ebff662d7783acf093053ac93b3
|
|
| BLAKE2b-256 |
6858563e0e9930811a390bade6d0133ec5f2f938fb01381b7532e42404d1ff5d
|
File details
Details for the file indic_itn-0.2.0-py3-none-any.whl.
File metadata
- Download URL: indic_itn-0.2.0-py3-none-any.whl
- Upload date:
- Size: 36.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0917f67330932933ce1e94d9947fe62682253e1de15134da7d021330078e4fb6
|
|
| MD5 |
a4e76d186ed52cdd711df00f6b1dbe87
|
|
| BLAKE2b-256 |
b11f92640f9db9a2caaa18e196912835fc0044caa1892790ebcaa841f79a4c6d
|