Skip to main content
Pre-release

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_number or pronounce_ordinal then 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

Related Projects

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

ovos_number_parser-0.6.1a3.tar.gz (165.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ovos_number_parser-0.6.1a3-py3-none-any.whl (162.0 kB view details)

Uploaded Python 3

File details

Details for the file ovos_number_parser-0.6.1a3.tar.gz.

File metadata

  • Download URL: ovos_number_parser-0.6.1a3.tar.gz
  • Upload date:
  • Size: 165.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for ovos_number_parser-0.6.1a3.tar.gz
Algorithm Hash digest
SHA256 b01bf1e48de730f306693d11abba3945e640d20bdc935f4b81e9a418893e07c3
MD5 35077048c8e3f1d7d3c1180974c6fc06
BLAKE2b-256 5cd392641fbadaec433a7ec96e30c7c0a5187072e5b660d231374ef51abb3574

See more details on using hashes here.

File details

Details for the file ovos_number_parser-0.6.1a3-py3-none-any.whl.

File metadata

File hashes

Hashes for ovos_number_parser-0.6.1a3-py3-none-any.whl
Algorithm Hash digest
SHA256 5bff98335b0661cba5da54189eebe0571a05a4400b752c3b0d3dc5eca7d77d7a
MD5 7d1187c71191cdf3bd30ec05c56204f3
BLAKE2b-256 728ace1c507f3e7c98a371c8b9ffdeb4e6be2ff971311ea1db2aca50105cf0ba

See more details on using hashes here.

Release history Release notifications | RSS feed

0.19.13

2 files

0.19.7

2 files

This release

0.6.1a3 This release

2 files

0.5.1

2 files

0.4.2

2 files

0.4.0

2 files

0.3.2

2 files

0.3.1

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page