This release is a pre-release and may not be stable for production use.
OVOS Number Parser
OVOS Number Parser is a tool for extracting, pronouncing, and detecting numbers from text across multiple languages. It supports functionalities like converting numbers to their spoken forms, extracting numbers from text, identifying fractional and ordinal numbers, and more.
Features
- Pronounce Numbers: Converts numerical values to their spoken forms.
- Pronounce Ordinals: Converts numbers to their ordinal forms.
- Extract Numbers: Extracts numbers from textual inputs.
- Detect Fractions: Identifies fractional expressions.
- Detect Ordinals: Checks if a text input contains an ordinal number.
Supported Languages
- โ - supported
- โ - not supported
- ๐ง - imperfect placeholder, usually a language agnostic implementation or external library
| Language Code | Pronounce Number | Pronounce Ordinal | Extract Number | numbers_to_digits |
|---|---|---|---|---|
en (English) |
โ | ๐ง | โ | โ |
az (Azerbaijani) |
โ | ๐ง | โ | โ |
ca (Catalan) |
โ | ๐ง | โ | ๐ง |
gl (Galician) |
โ | โ | โ | ๐ง |
cs (Czech) |
โ | ๐ง | โ | โ |
da (Danish) |
โ | โ | โ | ๐ง |
de (German) |
โ | โ | โ | โ |
es (Spanish) |
โ | ๐ง | โ | ๐ง |
eu (Euskara / Basque) |
โ | โ | โ | โ |
fa (Farsi / Persian) |
โ | ๐ง | โ | โ |
fr (French) |
โ | ๐ง | โ | โ |
hu (Hungarian) |
โ | โ | โ | โ |
it (Italian) |
โ | ๐ง | โ | โ |
nl (Dutch) |
โ | โ | โ | โ |
pl (Polish) |
โ | ๐ง | โ | โ |
pt (Portuguese) |
โ | โ | โ | โ |
mwl (Mirandese) |
โ | โ | โ | โ |
ast (Asturian) |
โ | โ | โ | โ |
ru (Russian) |
โ | ๐ง | โ | โ |
sv (Swedish) |
โ | โ | โ | โ |
sl (Slovenian) |
โ | ๐ง | โ | โ |
uk (Ukrainian) |
โ | ๐ง | โ | โ |
๐ก If a language is not implemented for
pronounce_numberorpronounce_ordinalthen unicode-rbnf will be used as a fallback
Installation
To install OVOS Number Parser, use:
pip install ovos-number-parser
Usage
from ovos_number_parser import (pronounce_number, pronounce_ordinal,
extract_number, is_fractional, is_ordinal,
numbers_to_digits)
pronounce_number(123, "en") # 'one hundred and twenty three'
pronounce_number(4.5, "pt") # 'quatro vรญrgula cinco'
pronounce_number(21, "de") # 'einundzwanzig'
pronounce_number(3, "en", ordinals=True) # 'third'
pronounce_ordinal(5, "de") # 'fรผnfte'
extract_number("set a timer for twenty one minutes", "en") # 21
extract_number("one hundred and one dalmatians", "en") # 101
extract_number("dos mil veintitrรฉs", "es") # 2023
extract_number("einundzwanzig Katzen", "de") # 21
extract_number("hello world", "en") # False
is_fractional("half", "en") # 0.5
is_ordinal("third", "en") # 3
numbers_to_digits("set a timer for five minutes", "en")
# 'set a timer for 5 minutes'
Grammatical gender is supported for languages that inflect numerals:
from ovos_number_parser.util import GrammaticalGender
pronounce_number(2, "pt", gender=GrammaticalGender.FEMININE) # 'duas'
Documentation
- API reference โ every public function and its parameters
- Language notes โ per-language behaviour and known gaps
- Adding a language โ implementation guide
- examples/ โ runnable example scripts
Related Projects
- ovos-date-parser - for handling dates and times
- ovos-lang-parser - for handling languages
- ovos-color-parser - for handling colors
License
This project is licensed under the Apache License 2.0.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ovos_number_parser-0.9.0a1.tar.gz.
File metadata
- Download URL: ovos_number_parser-0.9.0a1.tar.gz
- Upload date:
- Size: 175.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d367f01add812b8351511f5d6ba14a899efb4ca5e0d48a7f6001241a14452843
|
|
| MD5 |
e6c0204317a8568eef21cc895b279fc8
|
|
| BLAKE2b-256 |
93169eb81fd331c878c7138704f358ea2af7fa6a6f37c754c9fa236f7109d25f
|
File details
Details for the file ovos_number_parser-0.9.0a1-py3-none-any.whl.
File metadata
- Download URL: ovos_number_parser-0.9.0a1-py3-none-any.whl
- Upload date:
- Size: 167.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
795444ab717a5abc9f94bd3d2e6ea6c3c2faac7a0928ac3e46197dc6cb6a1611
|
|
| MD5 |
398314b60e5ebfb07c41d1ab764ac63a
|
|
| BLAKE2b-256 |
06e026b3ca1464484f2313a3911067a8b840d378164255828576ad85c6b7ab95
|