numparser

April 11, 2016 ยท View on GitHub

Python library for parsing numbers from strings.

Originally meant to be used to process results from Named Entity Recognizer.

Here's a sample strings which library can handle:

InputOutput
six million four hundred thousand five6,400,005
$410 million410,000,000
50,000,001 to $100,000,000100,000,000
Fifty-two Million Five HundredThousand Dollars52,500,000
less than $5,000,000.00 (five million dollars5,000,000
$50 million $160,00050,160,000

Note that short scale is used and currently there's no support for long scale.

Installation

pip install numparser

Quick Start

>>> import numparser
>>> numparser.numparser('one quadrillion two hundred thousands three')
1000000000200003.0

Unit tests

Clone the repository and run:

python tests.py