Skip to main content

Build Status

numerizer

A Python module to convert natural language numerics into ints and floats. This is a port of the Ruby gem numerizer

Installation

The NLG library can be installed from PyPI as follows:

$ pip install numerizer

or from source as follows:

$ git clone https://github.com/jaidevd/numerizer.git
$ cd numerizer
$ pip install -e .

Usage

>>> from numerizer import numerize
>>> numerize('forty two')
'42'
>>> numerize('forty-two')
'42'
>>> numerize('four hundred and sixty two')
'462'
>>> numerize('one fifty')
'150'
>>> numerize('twelve hundred')
'1200'
>>> numerize('twenty one thousand four hundred and seventy three')
'21473'
>>> numerize('one million two hundred and fifty thousand and seven')
'1250007'
>>> numerize('one billion and one')
'1000000001'
>>> numerize('nine and three quarters')
'9.75'
>>> numerize('platform nine and three quarters')
'platform 9.75'

Extras

For R users, a wrapper library has been developed by @amrrs. Try it out here.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

numerizer-0.1.6.tar.gz (4.6 kB view details)

Uploaded Source

File details

Details for the file numerizer-0.1.6.tar.gz.

File metadata

  • Download URL: numerizer-0.1.6.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.7

File hashes

Hashes for numerizer-0.1.6.tar.gz
Algorithm Hash digest
SHA256 546981dc0f23136810e8e996efcf9e1273da9e2deade0bf2945efee151846313
MD5 17fadbb16847d7f908ae87752d2d19f7
BLAKE2b-256 fee94d60495e58ed102f3f1aa999da8eb02509fe90be708f7837cfdae014c2ae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page