eonums /

Filename Size Date modified Message
29 B
47 B
34.3 KB
68 B
3.1 KB
14.0 KB
5.1 KB
15.9 KB
536 B
8.6 KB
9.2 KB
838 B
58 B
4.3 KB
5.6 KB

Eonums

Author: Dinu Gherman <gherman@darwin.in-berlin.de>
Homepage:http://www.dinu-gherman.net/
Version: Version 0.9.1
Date: 2012-06-20
Copyright: GNU Public Licence v3 (GPLv3)

About

Eonums is a simple module providing conversion between normal integer numbers and the corresponding textual expression in the Esperano language. It was mainly developped in order to explore the regularity of Esperanto expressions for big integer numbers.

Names for 10**k (k = 6, 9, 12, ...) like "miliono" (10**6) or "miliardo" (10**9) are chosen from the so-called "Longa Skalo" as described on this page about big numbers (in Esperanto).

The integer numbers eonums can convert to or from such Esperanto expressions can be arbitrarily large, but are limited in practice by the largest number for which there is a name in Esperanto (on the "Longa Skalo")", which is, on the previous page, 10**63 (dekiliardo). Hence, the largest integer you can handle with this module is 10**66 - 1. (This module makes no attempt to extend the Esperanto naming rules by introducing names like "undekiliono", "undekiliardo", "dudekiliono" etc.)

Version 0.9.1 now works on Python 2 and Python 3.

Features

  • convert Python integers to Esperanto integer strings (Unicode)
  • convert Esperanto integer strings (Unicode) to Python integers
  • validate Esperanto integer strings (Unicode)
  • handle integers from 0 to 10**66 - 1
  • provide conversion functions and command-line scripts
  • provide a Unittest test suite
  • runs the same code under Python 2 and Python 3

Examples

You can use eonums as a Python module e.g. like in the following interactive sessions:

Python 2:

>>> from eonums import int2eo, eo2int, validate_eo
>>>
>>> int2eo(22334455)
u'dudek du milionoj tricent tridek kvar mil kvarcent kvindek kvin'
>>>
>>> eo2int(u"cent dudek tri")
123
>>> validate_eo(u"dudek cent tri")
False

Python 3:

>>> from eonums import int2eo, eo2int, validate_eo
>>>
>>> int2eo(22334455)
'dudek du milionoj tricent tridek kvar mil kvarcent kvindek kvin'
>>>
>>> eo2int("cent dudek tri")
123
>>> validate_eo("dudek cent tri")
False

In addition there are two (very simple) conversion scripts, int2eo and eo2int, which can be used from the system command-line like this:

$ int2eo 22334455
dudek du milionoj tricent tridek kvar mil kvarcent kvindek kvin
$
$ eo2int "cent dudek tri"
123

History

  • 2008-09-15 (0.9.0): First official realease.
  • 2012-06-20 (0.9.1): Adapted code to run on Python 2 and Python 3.

Installation

There are two ways to install eonums, depending on whether you have the easy_install command available on your system or not.

1. Using easy_install or pip

With the easy_install command on your system and a working internet connection you can install eonums with only one command in a terminal:

$ easy_install eonums

If the easy_install command is not available to you and you want to install it before installing eonums, you might want to go to the Easy Install homepage and follow the instructions there.

You can also install eonums using pip the usual way, if it is already installed:

$ pip install eonums

2. Manual installation

Alternatively, you can install the eonums tarball after downloading the file eonums-0.9.0.tar.gz and decompressing it with the following command:

$ tar xfz eonums-0.9.1.tar.gz

Then change into the newly created directory eonums and install eonums by running the following command:

$ python setup.py install

This will install a Python module named eonums in the site-packages subfolder of your Python interpreter and two scripts tool named int2eo and eo2int in your bin directory, usually in /usr/local/bin.

Testing

The eonums distribution contains a Unittest test suite (not installed during installation) which can be run by simply executing the module test_eonums.py like the following on the system command-line in the unpacked distribution folder:

$ python test_eonums.py
...........
----------------------------------------------------------------------
Ran 11 tests in 17.477s

OK

It takes a short while because it contains a roundtrip test in which the first 100,000 integers are converted to Esperanto strings and back to normal integers.

Bug reports

Please report bugs and patches to Dinu Gherman <gherman@darwin.in-berlin.de>. Don't forget to include information about the operating system and Python versions being used.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.