A simple, deterministic, and extensible approach to inverse text normalization (ITN) for numbers.
Overview
This package converts raw spoken-form text (speech recognition output) into user-friendly written-form text. It works best for converting spoken numbers into numerical digits, or other translation tasks that do not modify word ordering. A csv file is provided to define the basic rules for transforming spoken tokens into written tokens, and extra pre/post-processing may be applied for more specific formatting requirements, i.e. dates, measurements, money, etc.
These examples were produced by running this script.
Installation
This package supports Python versions >= 3.7
To install from PyPI:
pip install itnpy2
To install locally:
pip install -e .
Tests
To run tests, use pytest in the root folder of this repository:
pytest
Issues
This package has been verified on a limited set of test-cases. For any translation mistakes, feel free to open a pull request and update failing.csv with the input, expected output, and mistake; thanks!
Citation
If you find this work useful, please consider citing it.
@misc{hsu2022itn,
title = {A simple, deterministic, and extensible approach to inverse text normalization for numbers},
author = {Brandhsu},
howpublished = {https://github.com/barseghyanartur/itnpy},
year = {2022}
}
Release files for itnpy2 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| itnpy2-0.0.7.tar.gz | 9.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| itnpy2-0.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.9 kB
Release files / itnpy2-0.0.7.tar.gz
| Download URL | itnpy2-0.0.7.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
67466fe9bd00c9e11ca6250e6f39dc84ee86f2005a2c679251e65e1ee5c5a116
|
|
BLAKE2b-256 checksum How to use checksums |
7728e3fccdc8d5747faf82b4d85dbb43472e446eefee98fa574baa0e4a2b94de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|
Release files / itnpy2-0.0.7-py3-none-any.whl
| Download URL | itnpy2-0.0.7-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a1b8fd82edc98be9ed99e527bbacf72febdd65a81f4a3d926723de02b03b0c0d
|
|
BLAKE2b-256 checksum How to use checksums |
281928e2c85e7f1fcb61c0960cf8a96d2781f484db23be42ae96cd8d2adba187
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|