What is the numerizer library in Python?

The numerizer library in Python

Natural language processing (NLP) refers to the understanding of natural human language by computers. One of the problems that we encounter in NLP is understanding numbers in words. We can perform these tasks using Python.

Python has rich libraries and packages that ease the life of a programmer. One of them is the numerizer library. The Numerizer package is one of the most used libraries, and helps developers to convert numbers in words to numeric digits. We can convert numbers from zero to trillion.

Installation

We need to install the numerizer library using the following pip command:

pip install numerizer

After the installation, we can import the numerize() method of the numerizer that helps in conversion.

Syntax

from numerizer import numerize
numerize(NumberInWords)

We import the numerize() function in the Python script, as shown above.

  • NumerInWords: This is a string that converts to a numeric number.

This method returns a string that can be type-cast to int.

Example

from numerizer import numerize
a = int(numerize('ten'))
print(a)
print(numerize('five thousand four hundred twenty and three quarters'))
print(numerize('twenty and quarter'))
print(numerize('9 hundred twenty half'))

Explanation

  • Line 1: We import the numerize() function from numerizer library.

  • Line 3: We pass the string as a parameter to the function. The function stores in a variable a after typecasting to an integer.

  • Lines 5–7: We pass the string as a parameter to the function. We print the result on the console.

Free Resources

Copyright ©2026 Educative, Inc. All rights reserved