NeMo Inverse Text Normalization: From Development to Production

Yang Zhang, Evelina Bakhturina, Kyle Gorman, Boris Ginsburg

Introduction

NVIDIA researchers have introduced the NeMo Text Processing (NTP) toolkit, an open-source Python library designed to bridge the gap between research and production for text normalization (TN) and inverse text normalization (ITN). By leveraging Weighted Finite-State Transducers (WFSTs), the toolkit provides a modular, extensible framework that allows developers to build complex linguistic grammars in Python and deploy them into high-performance C++ environments.

The Challenge of Non-Standard Words

In speech technology, "raw" text is rarely the desired output. Text Normalization (TN) is essential for Text-to-Speech (TTS), converting written forms like "$123" into spoken forms like "one hundred and twenty three dollars." Conversely, Inverse Text Normalization (ITN) is used in Automatic Speech Recognition (ASR) to transform spoken transcripts back into readable written forms (e.g., "on may third" to "on May 3").

The primary difficulty lies in "non-standard words" (semiotic classes) such as dates, currencies, and measures. Traditional rule-based systems are often brittle, while pure machine learning approaches can suffer from "unrecoverable errors," such as hallucinating numbers. NTP addresses this by providing a system that is both linguistically robust and production-ready.

Methodology: The NTP Pipeline

The NTP toolkit is built on WFSTs using the Pynini library. The core innovation is a four-stage API pipeline designed to handle the non-linear nature of language transformations.

The four-stage NTP pipeline for Inverse Text Normalization, illustrating the transition from spoken text to structured tokens and finally to formatted written text.

The pipeline consists of:

  1. classify(): Identifies semiotic tokens (e.g., recognizing "three dollars" as money) and inserts semantic tags.
  2. parse(): Converts the tagged string into a structured list of key-value pairs.
  3. generate_permutations(): A critical step that generates variations of key-value pairs. Since WFSTs process text linearly but written forms often reorder elements (e.g., "$123" vs "one hundred twenty three dollars"), this allows the transducer to match the correct output regardless of word order.
  4. verbalize(): Converts the structured representation into the final written form.

For production, these Python-defined grammars are exported to the Sparrowhawk C++ framework, ensuring high performance for real-time ASR or TTS applications.

Evaluation and Key Results

The system was evaluated using the Google Text Normalization dataset. The authors adapted a subset of approximately 92,000 tokens for ITN by swapping inputs and outputs and using regex rules to resolve mapping ambiguities.

Accuracy results for Text Normalization (TN) and Inverse Text Normalization (ITN) across various semiotic classes, demonstrating high precision in categories like Decimals and Cardinals.

As shown in the results, the system achieved exceptional accuracy across several categories:

  • Decimals: 100% accuracy in both TN and ITN.
  • Cardinals: 99.6% accuracy for ITN.
  • Dates: 94.9% accuracy for ITN and 95.9% for TN.
  • Overall Sentence Accuracy: 73.7% for ITN. While lower than token-level accuracy, this is expected as a single error in a long sentence invalidates the entire entry.

Conclusion

The NeMo Text Processing toolkit offers a hybrid approach that combines the ease of Python-based development with the efficiency of C++ deployment. By introducing a permutation-based solution for non-linear language transformations and a modular design for semiotic classes, NTP provides a robust framework for building production-grade speech systems. Future work will focus on expanding multi-language support and handling more complex semiotic classes like specialized electronic formats.

Summary updated

BibTeX
@inproceedings{zhang2021nemo,
  author = {Yang Zhang and Evelina Bakhturina and Kyle Gorman and Boris Ginsburg},
  title = {{NeMo Inverse Text Normalization: From Development to Production}},
  booktitle = {Interspeech},
  year = {2021},
  doi = {10.21437/interspeech.2021-1571},
}
Figure