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) โœ… โŒ โœ… โŒ
et (Estonian) โœ… โœ… โœ… โœ…
fa (Farsi / Persian) โœ… ๐Ÿšง โœ… โŒ
fi (Finnish) โœ… โœ… โœ… โœ…
fr (French) โœ… ๐Ÿšง โœ… โŒ
hr (Croatian) โœ… โœ… โœ… โœ…
hu (Hungarian) โœ… โœ… โŒ โŒ
it (Italian) โœ… ๐Ÿšง โœ… โŒ
kab (Kabyle) โœ… โœ… โœ… ๐Ÿšง
nl (Dutch) โœ… โœ… โœ… โœ…
pl (Polish) โœ… ๐Ÿšง โœ… โœ…
pt (Portuguese) โœ… โœ… โœ… โœ…
mwl (Mirandese) โœ… โœ… โœ… โœ…
ast (Asturian) โœ… โœ… โœ… โœ…
oc (Occitan) โœ… โœ… โœ… โœ…
ro (Romanian) โœ… โœ… โœ… โœ…
an (Aragonese) โœ… โœ… โœ… โœ…
fy (West Frisian) โœ… โœ… โœ… โœ…
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.18.2a1.tar.gz (309.1 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.18.2a1-py3-none-any.whl (273.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ovos_number_parser-0.18.2a1.tar.gz
  • Upload date:
  • Size: 309.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ovos_number_parser-0.18.2a1.tar.gz
Algorithm Hash digest
SHA256 6232eabc8f9a9d38966bf6c8a856bd2d256fd0c5d2b1a1c21f4a8d32d788cf20
MD5 0ac6aa806b5b7845e25d8f9cff4241fc
BLAKE2b-256 f7440f24448ab22e38629a4d88f9bca21af45d6789cb8a586872a9269a7c62f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ovos_number_parser-0.18.2a1-py3-none-any.whl
Algorithm Hash digest
SHA256 fc0681895331e9d1b1b43f4df545b5a110fc75b99a8270b8798c9f75829e9499
MD5 21f6938b2ebfb2fe947329fd2cc551a4
BLAKE2b-256 5b1806dd70fc6c0a6e71398f70f15ab223b0a2bb712d23f39c45af07ce03f884

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