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.8.0a1.tar.gz (173.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.8.0a1-py3-none-any.whl (166.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ovos_number_parser-0.8.0a1.tar.gz
  • Upload date:
  • Size: 173.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.8.0a1.tar.gz
Algorithm Hash digest
SHA256 7b3dcb87fd8f75dddbc32bd5d9233e2ee0e6d44e92622ba64531c57556226b0e
MD5 b2df316408ebf5d3474ce07f3a44c927
BLAKE2b-256 77914dba6dc9890b258b9e6d12f72533caaab651e7107a0e5d121c21ba79eb7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ovos_number_parser-0.8.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 b39dd850f5a66b33f1c69b999c8855f7c856436bbff78d48e1604de230e2a604
MD5 cf68e6da353db67b95af41a3363d0675
BLAKE2b-256 efdbe8a1e6a1a4edeac0a12d684375140ae936061176ffcb83e1713f0f512668

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.8.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