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) โœ… ๐Ÿšง โœ… โŒ
kab (Kabyle) โœ… โœ… โœ… ๐Ÿšง
nl (Dutch) โœ… โœ… โœ… โœ…
pl (Polish) โœ… ๐Ÿšง โœ… โœ…
pt (Portuguese) โœ… โœ… โœ… โœ…
mwl (Mirandese) โœ… โœ… โœ… โœ…
ast (Asturian) โœ… โœ… โœ… โœ…
oc (Occitan) โœ… โœ… โœ… โœ…
ro (Romanian) โœ… โœ… โœ… โœ…
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.15.0a1.tar.gz (205.7 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.15.0a1-py3-none-any.whl (187.4 kB view details)

Uploaded Python 3

File details

Details for the file ovos_number_parser-0.15.0a1.tar.gz.

File metadata

  • Download URL: ovos_number_parser-0.15.0a1.tar.gz
  • Upload date:
  • Size: 205.7 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.15.0a1.tar.gz
Algorithm Hash digest
SHA256 10bed58e329b53d4b569cb1f1f30a83487a867fce878f3ca7a4ff7875025072e
MD5 cad7dd76f546026b1e374375cafd240d
BLAKE2b-256 bcc4edd68afd50da3a3a6b2500a42bd10806020da6212e8074c5700b33df8e0c

See more details on using hashes here.

File details

Details for the file ovos_number_parser-0.15.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for ovos_number_parser-0.15.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 c88e5172a13216c57d75571cfb8052fb07ee38005f948b9c9eb81129e5d4cf9b
MD5 6653730c4912b2dcba76ba0615f010e5
BLAKE2b-256 db7f9c2c0d0326158c61adff92d550f6d767ecf2f53e80e68137cedb3d8adbcb

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.15.0a1 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