numeral_english_to_arabic

pyhelpers.text.numeral_english_to_arabic(x)

Convert a string which potentially is a number written in English to an Arabic number

Parameters

x (str) – a number written in English

Returns

a number written in Arabic

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"