Skip to main content

A simple, deterministic, and extensible approach to inverse text normalization for numbers

Project description

PyPI Version Supported Python versions Build Status Documentation Status MIT

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.


Terminal

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}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

itnpy2-0.0.7.tar.gz (9.2 kB view hashes)

Uploaded Source

Built Distribution

itnpy2-0.0.7-py3-none-any.whl (6.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page