Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install digify

How to install Digify

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install digify
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
Linux (32-bit)
0.2 Available View build log
0.1dev Available View build log
Linux (64-bit)
0.2 Available View build log
0.1dev Available View build log
 
License
BSD
Imports
Lastest release
version 0.2 on Jan 31st, 2013

Convert spelled numbers such as 'one thousand, two hundred and thirty-three' or 'one thousand two hundred thirty three' to their equivalent forms in digits (1233).

Handles British-style "and" as well as US versions without "and", and accepts commas and hyphens in appropriate positions (although they are never compulsory)

>>> spelled_num_to_digits("one")
1
>>> spelled_num_to_digits("twelve")
12
>>> spelled_num_to_digits("seventy-two")
72
>>> spelled_num_to_digits("Three hundred")
300
>>> spelled_num_to_digits("TWELVE HUNDRED")
1200
>>> spelled_num_to_digits("twelve thousand three hundred four")
12304
>>> spelled_num_to_digits("twelve thousand, five hundred and six")
12506
>>> spelled_num_to_digits("six   Million")
6000000
>>> spelled_num_to_digits("six million four hundred thousand five")
6400005
>>> spelled_num_to_digits(
...   'one hundred twenty three billion, four hundred fifty six million, '
...   'seven hundred eighty nine thousand twelve')
123456789012
>>> spelled_num_to_digits("four decillion")
4000000000000000000000000000000000L
>>> replace_spelled_numbers('There are TEN sponges')
'There are 10 sponges'
>>> replace_spelled_numbers('I got ninety nine problems')
'I got 99 problems'
>>> replace_spelled_numbers('He got two million, one hundred and '
...   'eighty-two thousand, three hundred and twenty five problems')
'He got 2182325 problems'
>>> replace_spelled_numbers('I have five coconuts and two hundred '
...   'thirty three carrots')
'I have 5 coconuts and 233 carrots'

Adapted and extended from https://github.com/ghewgill/text2num

Subscribe to package updates

Last updated Jan 31st, 2013

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.