spa2num

An spanish word converter to numerical digits

Latest Version on PyPI Supported Implementations Build Status Documentation Status Coverage Status Built with PyPi Template

Contents

Code Documentation

exception spa2num.converter.Spa2NumLexiconException
exception spa2num.converter.Spa2NumSyntaxException
spa2num.converter.to_number(x)

Allows you to translate to integer numerical words spelled in spanish.

Text must be previously cleaned & removed extraneous words or symbols. Quantities MUST be written in a correct Spanish. The upper limit is up to the millions range. No decimal supported.

Args:

An spanish spelled number.

Returns:

Integer translated from the Spanish text string

Getting Started

Installation

Package spa2num is hosted on PyPi, so…

$ pip install spa2num

Usage

>>> from spa2num.converter import to_number
>>> to_number("ciento veintitrés millones cuatrocientos cincuenta y seis mil setecientos ochenta y nueve")
123456789
>>> to_number("novecientos ochenta y siete millones seiscientos cincuenta y cuatro mil trescientos veintiuno")
987654321

Testing

A testing setup has been prepared. To run it locally, issue…

$ make test
...
___________________________________ summary ____________________________________
  py27: commands succeeded
  congratulations :)

Generate Documentation

$ make docs

This wil generate a HTML version of your docs/ and open it in a browser.

Contributing

This is Open Source software, so given enough eyeballs, all bugs are shallow. Your contributions are more than welcome.

This project is hosted on GitHub and these (common) rules apply:

  • Do use the issues tracker.

  • Let’s discuss any proposed change or fix in an issue, so your work is not done in vain - I hate to reject pull requests…

  • Create pull requests against next branch.

  • Try to keep pull requests “atomic”, and if possible related to an issue.