Skip to main content

whisper_normalizer

A python package for text standardisation/normalization. It uses normalization algorithm mentioned in OpenAI whisper paper. Using Whisper normalization can cause issues in Indic languages and other low resource languages when using BasicTextNormalizer. So normalization in Indic languages is also implemented in this package which was derived from indic-nlp-library.

PyPI Downloads Github license Github Stars PyPI version Humans behind

This package is a python implementation of the text standardisation/normalization approach which is being used in OpenAI whisper. The code was originally being released as open-source in Whisper source code. More details about the text normalization approach used by whisper can be found on Appendix Section C pp.21 the paper Robust Speech Recognition via Large-Scale Weak Supervision by OpenAI team.

Installation of package

pip install whisper_normalizer

or from github repository

pip install git+https://github.com/kurianbenoy/whisper_normalizer.git

How to use the package

  • I made a video walk through on how to use the whisper_normalizer python package.

Colab Notebook Link of walk through

Github Gist Link of walk through

Hello world to whisper_normalizer

Why should we normalize/standardize text?

  • In ASR systems it’s important to normalize the text to reduce unintentional penalties in metrics like WER, CER etc.
  • Text normalization/standardization is process of converting texts in different styles into a standardized form, which is a best-effort attempt to penalize only when a word error is caused by actually mistranscribing a word, and not by formatting or punctuation differences.(from Whisper paper)

Why use this python package?

This package is a python implementation of the text standardisation/normalization approach which is being used in OpenAI whisper text normalizer. If you want to use just text normalization alone, it’s better to use this instead reimplementing the same thing. OpenAI approach of text normalization is very helpful and is being used as normalization step when evaluating competitive models like AssemblyAI Conformer-1 model.

Models evaluated using Whisper normalization

  • OpenAI Whisper
  • Massively Multilingual Speech (MMS) models by Meta
  • Conformer 1 by AssemblyAI
  • Conformer 2 by AssemblyAI

How to use

OpenAI open source approach of text normalization/standardization is mentioned in detail Appendix Section C pp.21 the paper Robust Speech Recognition via Large-Scale Weak Supervision.

Whisper Normalizer by default comes with two classes BasicTextNormalizer and EnglishTextNormalizer

You can use the same thing in this package as follows:

from whisper_normalizer.english import EnglishTextNormalizer

english_normalizer = EnglishTextNormalizer()
english_normalizer("I'm a little teapot, short and stout. Tip me over and pour me out!")
'i am a little teapot short and stout tip me over and pour me out'
from whisper_normalizer.basic import BasicTextNormalizer

normalizer = BasicTextNormalizer()
normalizer("I'm a little teapot, short and stout. Tip me over and pour me out!")
'i m a little teapot short and stout tip me over and pour me out '

Using BasicTextNormalizer in your mother tongue might be a bad idea

Whisper Text Normalizer is not always recommended to be used. Dr Kavya Manohar has written a blogpost on why it might be a bad idea on her blopost titled Indian Languages and Text Normalization: Part 1.

If you need the basic normalizer for Indic or other scripts that use Unicode Mark characters, use BasicTextNormalizer(preserve_marks=True). This preserves combining marks such as Brahmic vowel signs and viramas while retaining the remaining basic normalization behavior.

This model extends Whisper_normalizer to support Indic languages as well.

The logic for normalization in Indic languages is derived from indic-nlp-library. The logic for Malayalam normalization is expanded beyond the Indic NLP library by MalayalamNormalizer.

from whisper_normalizer.indic import MalayalamNormalizer

normalizer = MalayalamNormalizer()
normalizer("എന്റെ കമ്പ്യൂട്ടറിനു് എന്റെ ഭാഷ.")
'എന്റെ കമ്പ്യൂട്ടറിന് എന്റെ ഭാഷ.'

Metadata

Release files for whisper-normalizer 0.1.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for whisper-normalizer 0.1.15
File Size Uploaded
whisper_normalizer-0.1.15.tar.gz 41.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for whisper-normalizer 0.1.15
File Interpreter ABI Platform
whisper_normalizer-0.1.15-py3-none-any.whl Python 3 none any Details

Total release size: 80.7 kB

Release files / whisper_normalizer-0.1.15.tar.gz

Download URL whisper_normalizer-0.1.15.tar.gz
Size 41.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6afec010671cc00cb4948957b4455f5e1bd1aacc76d3edbda980a27b2415f523
BLAKE2b-256 checksum
How to use checksums
5db2fc7d95153c350002154aeb87bd6732a9189a94e13586222c16cd28147769
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Release files / whisper_normalizer-0.1.15-py3-none-any.whl

Download URL whisper_normalizer-0.1.15-py3-none-any.whl
Size 39.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2871b3c56557628dc30749bf3ffac7bc4ac3d3f497b0b24df27d0c4c434e113f
BLAKE2b-256 checksum
How to use checksums
5f065e2cbb3267a1c7aa8f425c679b9ff5f8c04a47aa15157d493a95a746c374
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Release history Release notifications | RSS feed

This release

0.1.15 This release

2 release files

0.1.14

2 release files

0.1.13

1 release file

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.4

1 release file

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page