This release is a pre-release and may not be stable for production use.
Numbers2Words Greek
Features
This repository contains code for converting converting numbers
to words (e.g. 10 -> δέκα) up until 10^13 - 1 (1 trillion minus one).
- Convert numbers to greek words.
- Support for ordinals.
- Support for certain time formats.
Installation:
You can install Numbers2Words Greek via pip from PyPI:
$ pip install Numbers2Words-Greek
If using poetry, then you can do poetry add Numbers2Words-Greek.
To install this repository locally, in editable mode, do the following:
git clone https://github.com/geoph9/Numbers2Words-Greek.git
cd Numbers2Words-Greek
pip install -e .
If no error occurs then you are fine. To make sure, you may run:
python -c "import num2word".
Usage
The numbers2words.py script:
This script contains functionality to convert numbers to their corresponding words in Greek. It only handles positive numbers (you can easily change it to handle negative ones) and can also handle decimals (only if the decimal part is separated using "," instead of ".") and hours (e.g. 2:30 -> δύο και μισή). It is important to note that this algorithm does not take into account the gender of the noun following each number. Also, the numbers will be converted as is and there is no post-processing like "2.5 ευρώ" -> "δυόμιση ευρώ" (the output will be "δύο κόμμα πέντε ευρώ").
If you only need to convert numbers to words then you may use this script as described below:
python -m num2word [--test-word <<WORD>>] [--path <<PATH>>] [--extension .lab] [--out-path]
Arguments:
-
-tor--test-word: Use this only for testing. Put a word or number after it and check the result. E.g.python -m num2word -t 150should printεκατόν πενήντα. -
-por--path: Provide a valid path. The path must be either a text file or a directory containing many files (the extension of these files is defined by the-eor--extensionoption, defaults to.txt). Cases:- Directory: Inside this directory there needs to be multiple text files which you want to convert. The words inside the file will not be change and only the numbers will be replaced by their corresponding words.
- File: If you provide a file then the same thing will happen but just for this file.
-
-eor--extension: Use this to change the extension of the text files you have provided in--path. This only matters if you have provided a directory.
Example:
# num2word is the package and numbers2words.py is the script.
python -m num2word --path /home/user/data/transcriptions \
--extension .txt
The above will read all the .txt files inside the transcriptions
directory and will change the numbers to their corresponding greek words.
Future Work:
- Handle fractions in
numbers2words. E.g. Convert "1/10" to "ένα δέκατο". - Handle time input in
numbers2words. E.g. Convert "11:20" to "έντεκα και είκοσι"
Contributing
Contributions are very welcome. To learn more, see the Contributor Guide.
License
Distributed under the terms of the MIT license, Numbers2Words Greek is free and open source software.
Issues
If you encounter any problems, please file an issue along with a detailed description.
Credits
This project was generated from @cjolowicz's Hypermodern Python Cookiecutter template.
Metadata
Release files for numbers2words-greek 0.0.2a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| Numbers2Words-Greek-0.0.2a0.tar.gz | 15.2 kB | Without provenance | Details for Numbers2Words-Greek-0.0.2a0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| Numbers2Words_Greek-0.0.2a0-py3-none-any.whl | Python 3 | none | any | Details for Numbers2Words_Greek-0.0.2a0-py3-none-any.whl |
Total release size: 32.1 kB
Release files / Numbers2Words-Greek-0.0.2a0.tar.gz
| Download URL | Numbers2Words-Greek-0.0.2a0.tar.gz |
|---|---|
| Size | 15.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5ee422cc12c6a0ba09152dc5e7764cf3e25d405a3ebce20e269f4a34212fd4d2
|
|
BLAKE2b-256 checksum How to use checksums |
8f74c5ea52615fea273db14b6b7b8935fb48c94a9f393ad4eef1e72514213e77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.14 CPython/3.7.7 Linux/5.4.0-122-generic
|
Release files / Numbers2Words_Greek-0.0.2a0-py3-none-any.whl
| Download URL | Numbers2Words_Greek-0.0.2a0-py3-none-any.whl |
|---|---|
| Size | 16.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
24c8626d1c297b9372373b19c0a668ee2cfbeec6f8c55f59c5a0eb636feac190
|
|
BLAKE2b-256 checksum How to use checksums |
1478de367f6266a8ddaae724ee5b95e5d7a6b158673ba5f5ed4a006a1893befc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.14 CPython/3.7.7 Linux/5.4.0-122-generic
|
Security for numbers2words-greek 0.0.2a0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.