# whisper_normalizer
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
> 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`](https://kurianbenoy.github.io/whisper_normalizer/basic.html#basictextnormalizer).
> So normalization in Indic languages is also implemented in this
> package which was derived from
> [indic-nlp-library](https://github.com/anoopkunchukuttan/indic_nlp_library).
[![Github
license](https://img.shields.io/github/license/kurianbenoy/whisper_normalizer.svg)](https://github.com/kurianbenoy/whisper_normalizer/blob/main/LICENSE)
[![Github
Stars](https://img.shields.io/github/stars/kurianbenoy/whisper_normalizer.svg?colorA=orange&colorB=orange&logo=github)](https://github.com/kurianbenoy/whisper_normalizer/stargazers)
[![PyPI
version](https://img.shields.io/pypi/v/whisper-normalizer.svg?style=flat-square&logo=pypi&logoColor=white)](https://pypi.org/project/whisper-normalizer/)
<!-- [![Downloads](https://static.pepy.tech/badge/whisper-normalizer)](https://github.com/kurianbenoy/whisper_normalizer) -->
<!-- [![python version](https://img.shields.io/badge/Python-%3E=3.7-blue)](https://github.com/kurianbenoy/whisper_normalizer)
[![python version](https://img.shields.io/badge/Python-<3.12-blue)](https://github.com/kurianbenoy/whisper_normalizer) -->
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](https://github.com/openai/whisper). 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](https://cdn.openai.com/papers/whisper.pdf)
by OpenAI team.
## Installation of package
``` sh
pip install whisper_normalizer
```
or from github repository
``` sh
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](https://colab.research.google.com/gist/kurianbenoy/7d27d9ec193a4a97ec7821235bddc506/hello-world_whisper_normalizer.ipynb)
[Github Gist Link of walk
through](https://gist.github.com/kurianbenoy/7d27d9ec193a4a97ec7821235bddc506)
[![Hello world to
whisper_normalizer](https://img.youtube.com/vi/c7trf0zul6g/0.jpg)](https://www.youtube.com/watch?v=c7trf0zul6g)
## 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](https://cdn.openai.com/papers/whisper.pdf))
## 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](https://www.assemblyai.com/blog/conformer-1/).
## 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](https://cdn.openai.com/papers/whisper.pdf).
Whisper Normalizer by default comes with two classes
[`BasicTextNormalizer`](https://kurianbenoy.github.io/whisper_normalizer/basic.html#basictextnormalizer)
and
[`EnglishTextNormalizer`](https://kurianbenoy.github.io/whisper_normalizer/english.html#englishtextnormalizer)
You can use the same thing in this package as follows:
``` python
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'
``` python
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](https://www.linkedin.com/in/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](https://kavyamanohar.com/post/indic-normalizer/).
## This model extends Whisper_normalizer to support Indic languages as well.
The logic for normalization in Indic languages is derived from
[indic-nlp-library](https://github.com/anoopkunchukuttan/indic_nlp_library).
The logic for Malayalam normalization is expanded beyond the Indic NLP
library by
[`MalayalamNormalizer`](https://kurianbenoy.github.io/whisper_normalizer/1b.indic_normalizer.html#malayalamnormalizer).
``` python
from whisper_normalizer.indic_normalizer import MalayalamNormalizer
normalizer = MalayalamNormalizer()
normalizer("എന്റെ കമ്പ്യൂട്ടറിനു് എന്റെ ഭാഷ.")
```
'എന്റെ കമ്പ്യൂട്ടറിന് എന്റെ ഭാഷ.'
Raw data
{
"_id": null,
"home_page": "https://github.com/kurianbenoy/whisper_normalizer",
"name": "whisper-normalizer",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "nbdev jupyter notebook openai whisper normalizer",
"author": "kurianbenoy",
"author_email": "kurian.bkk@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/9a/cf/8fae4b4b0607f0737e037b9eeffed5077972dd79f24a52b9922280967ff4/whisper_normalizer-0.0.10.tar.gz",
"platform": null,
"description": "# whisper_normalizer\n\n\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\n> A python package for text standardisation/normalization. It uses\n> normalization algorithm mentioned in OpenAI whisper paper. Using\n> Whisper normalization can cause issues in Indic languages and other\n> low resource languages when using\n> [`BasicTextNormalizer`](https://kurianbenoy.github.io/whisper_normalizer/basic.html#basictextnormalizer).\n> So normalization in Indic languages is also implemented in this\n> package which was derived from\n> [indic-nlp-library](https://github.com/anoopkunchukuttan/indic_nlp_library).\n\n[![Github\nlicense](https://img.shields.io/github/license/kurianbenoy/whisper_normalizer.svg)](https://github.com/kurianbenoy/whisper_normalizer/blob/main/LICENSE)\n[![Github\nStars](https://img.shields.io/github/stars/kurianbenoy/whisper_normalizer.svg?colorA=orange&colorB=orange&logo=github)](https://github.com/kurianbenoy/whisper_normalizer/stargazers)\n[![PyPI\nversion](https://img.shields.io/pypi/v/whisper-normalizer.svg?style=flat-square&logo=pypi&logoColor=white)](https://pypi.org/project/whisper-normalizer/)\n<!-- [![Downloads](https://static.pepy.tech/badge/whisper-normalizer)](https://github.com/kurianbenoy/whisper_normalizer) -->\n<!-- [![python version](https://img.shields.io/badge/Python-%3E=3.7-blue)](https://github.com/kurianbenoy/whisper_normalizer)\n[![python version](https://img.shields.io/badge/Python-<3.12-blue)](https://github.com/kurianbenoy/whisper_normalizer) -->\n\nThis package is a python implementation of the text\nstandardisation/normalization approach which is being used in OpenAI\nwhisper. The code was originally being released as open-source in\n[Whisper source code](https://github.com/openai/whisper). More details\nabout the text normalization approach used by whisper can be found on\nAppendix Section C pp.21 the paper [Robust Speech Recognition via\nLarge-Scale Weak Supervision](https://cdn.openai.com/papers/whisper.pdf)\nby OpenAI team.\n\n## Installation of package\n\n``` sh\npip install whisper_normalizer\n```\n\nor from github repository\n\n``` sh\npip install git+https://github.com/kurianbenoy/whisper_normalizer.git\n```\n\n## How to use the package\n\n- I made a video walk through on how to use the `whisper_normalizer`\n python package.\n\n[Colab Notebook Link of walk\nthrough](https://colab.research.google.com/gist/kurianbenoy/7d27d9ec193a4a97ec7821235bddc506/hello-world_whisper_normalizer.ipynb)\n\n[Github Gist Link of walk\nthrough](https://gist.github.com/kurianbenoy/7d27d9ec193a4a97ec7821235bddc506)\n\n[![Hello world to\nwhisper_normalizer](https://img.youtube.com/vi/c7trf0zul6g/0.jpg)](https://www.youtube.com/watch?v=c7trf0zul6g)\n\n## Why should we normalize/standardize text?\n\n- In ASR systems it\u2019s important to normalize the text to reduce\n unintentional penalties in metrics like WER, CER etc.\n- Text normalization/standardization is process of converting texts in\n different styles into a standardized form, which is a best-effort\n attempt to penalize only when a word error is caused by actually\n mistranscribing a word, and not by formatting or punctuation\n differences.(from [Whisper\n paper](https://cdn.openai.com/papers/whisper.pdf))\n\n## Why use this python package?\n\nThis package is a python implementation of the text\nstandardisation/normalization approach which is being used in OpenAI\nwhisper text normalizer. If you want to use just text normalization\nalone, it\u2019s better to use this instead reimplementing the same thing.\nOpenAI approach of text normalization is very helpful and is being used\nas normalization step when evaluating competitive models like\n[AssemblyAI Conformer-1\nmodel](https://www.assemblyai.com/blog/conformer-1/).\n\n## Models evaluated using Whisper normalization\n\n- OpenAI Whisper\n- Massively Multilingual Speech (MMS) models by Meta\n- Conformer 1 by AssemblyAI\n- Conformer 2 by AssemblyAI\n\n## How to use\n\nOpenAI open source approach of text normalization/standardization is\nmentioned in detail Appendix Section C pp.21 the paper [Robust Speech\nRecognition via Large-Scale Weak\nSupervision](https://cdn.openai.com/papers/whisper.pdf).\n\nWhisper Normalizer by default comes with two classes\n[`BasicTextNormalizer`](https://kurianbenoy.github.io/whisper_normalizer/basic.html#basictextnormalizer)\nand\n[`EnglishTextNormalizer`](https://kurianbenoy.github.io/whisper_normalizer/english.html#englishtextnormalizer)\n\nYou can use the same thing in this package as follows:\n\n``` python\nfrom whisper_normalizer.english import EnglishTextNormalizer\n\nenglish_normalizer = EnglishTextNormalizer()\nenglish_normalizer(\"I'm a little teapot, short and stout. Tip me over and pour me out!\")\n```\n\n 'i am a little teapot short and stout tip me over and pour me out'\n\n``` python\nfrom whisper_normalizer.basic import BasicTextNormalizer\n\nnormalizer = BasicTextNormalizer()\nnormalizer(\"I'm a little teapot, short and stout. Tip me over and pour me out!\")\n```\n\n 'i m a little teapot short and stout tip me over and pour me out '\n\n## Using BasicTextNormalizer in your mother tongue might be a bad idea\n\nWhisper Text Normalizer is not always recommended to be used. [Dr Kavya\nManohar](https://www.linkedin.com/in/kavya-manohar/) has written a\nblogpost on why it might be a bad idea on her [blopost titled Indian\nLanguages and Text Normalization: Part\n1](https://kavyamanohar.com/post/indic-normalizer/).\n\n## This model extends Whisper_normalizer to support Indic languages as well.\n\nThe logic for normalization in Indic languages is derived from\n[indic-nlp-library](https://github.com/anoopkunchukuttan/indic_nlp_library).\nThe logic for Malayalam normalization is expanded beyond the Indic NLP\nlibrary by\n[`MalayalamNormalizer`](https://kurianbenoy.github.io/whisper_normalizer/1b.indic_normalizer.html#malayalamnormalizer).\n\n``` python\nfrom whisper_normalizer.indic_normalizer import MalayalamNormalizer\n\nnormalizer = MalayalamNormalizer()\nnormalizer(\"\u0d0e\u0d28\u0d4d\u0d31\u0d46 \u0d15\u0d2e\u0d4d\u0d2a\u0d4d\u0d2f\u0d42\u0d1f\u0d4d\u0d1f\u0d31\u0d3f\u0d28\u0d41\u0d4d \u0d0e\u0d28\u0d4d\u0d31\u0d46 \u0d2d\u0d3e\u0d37.\")\n```\n\n '\u0d0e\u0d28\u0d4d\u0d31\u0d46 \u0d15\u0d2e\u0d4d\u0d2a\u0d4d\u0d2f\u0d42\u0d1f\u0d4d\u0d1f\u0d31\u0d3f\u0d28\u0d4d \u0d0e\u0d28\u0d4d\u0d31\u0d46 \u0d2d\u0d3e\u0d37.'\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "A python package for whisper normalizer",
"version": "0.0.10",
"project_urls": {
"Homepage": "https://github.com/kurianbenoy/whisper_normalizer"
},
"split_keywords": [
"nbdev",
"jupyter",
"notebook",
"openai",
"whisper",
"normalizer"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f87803ab331f7baa9314103140f97fe9cf899dc31f902c42a3054f0e83a2f521",
"md5": "d63fd44693502c55e576054259f174a1",
"sha256": "40de10f7edbfda01f11cbc11b76c01372ce16789c55cfa1746be234eb90c2d2d"
},
"downloads": -1,
"filename": "whisper_normalizer-0.0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d63fd44693502c55e576054259f174a1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 23185,
"upload_time": "2024-06-09T18:57:51",
"upload_time_iso_8601": "2024-06-09T18:57:51.411960Z",
"url": "https://files.pythonhosted.org/packages/f8/78/03ab331f7baa9314103140f97fe9cf899dc31f902c42a3054f0e83a2f521/whisper_normalizer-0.0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9acf8fae4b4b0607f0737e037b9eeffed5077972dd79f24a52b9922280967ff4",
"md5": "c8e0e9dca349011605bb1ba9224b99ec",
"sha256": "87fce0dbf4977ba7fb821cf6043a0fba6bdacd2f721ffbbe5dad70ae51038ab7"
},
"downloads": -1,
"filename": "whisper_normalizer-0.0.10.tar.gz",
"has_sig": false,
"md5_digest": "c8e0e9dca349011605bb1ba9224b99ec",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 24782,
"upload_time": "2024-06-09T18:57:53",
"upload_time_iso_8601": "2024-06-09T18:57:53.534873Z",
"url": "https://files.pythonhosted.org/packages/9a/cf/8fae4b4b0607f0737e037b9eeffed5077972dd79f24a52b9922280967ff4/whisper_normalizer-0.0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-09 18:57:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kurianbenoy",
"github_project": "whisper_normalizer",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "whisper-normalizer"
}