numeral_english_to_arabic

pyhelpers.text.numeral_english_to_arabic(x)[source]

Convert a number written in English words into its equivalent numerical value represented in Arabic numerals.

Parameters:

x (str) – a number expressed in the English language

Returns:

the equivalent Arabic number

Return type:

int

Examples:

>>> from pyhelpers.text import numeral_english_to_arabic

>>> numeral_english_to_arabic('one')
1

>>> numeral_english_to_arabic('one hundred and one')
101

>>> numeral_english_to_arabic('a thousand two hundred and three')
1203

>>> numeral_english_to_arabic('200 and five')
205

>>> numeral_english_to_arabic('Two hundred and fivety')  # Two hundred and fifty
Exception: Illegal word: "fivety"