Skip to main content

A python package for whisper normalizer

Project description

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.

Github license Github Stars PyPI version

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.

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_normalizer import MalayalamNormalizer

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

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

whisper_normalizer_offline-0.0.12.tar.gz (36.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

whisper_normalizer_offline-0.0.12-py3-none-any.whl (33.7 kB view details)

Uploaded Python 3

File details

Details for the file whisper_normalizer_offline-0.0.12.tar.gz.

File metadata

File hashes

Hashes for whisper_normalizer_offline-0.0.12.tar.gz
Algorithm Hash digest
SHA256 210129ed8bc0671555b1c733d8e2853e209ace5d8f677a17a38eadabf79c714a
MD5 b8692e9a208c980a2611ebe29b865192
BLAKE2b-256 92d87c3acc5836f9db5d582b5f135c0f148ab077d150e9db9d04c2e4021aad45

See more details on using hashes here.

File details

Details for the file whisper_normalizer_offline-0.0.12-py3-none-any.whl.

File metadata

File hashes

Hashes for whisper_normalizer_offline-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 8829cd28a7e9129ad704476a8dc610bdf51f4ae43334336c743445541dc6199f
MD5 34fb13fc70e8a2121b62d81a757e98ff
BLAKE2b-256 264c5e32d369f24cfc410e687e46eb768ca6b11b26a4465c48f354c855f7c7d6

See more details on using hashes here.

Supported by

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