Skip to main content

Convert written-out numbers to digits in multiple languages using a fast Rust + Python binding.

Project description

text2num-py

Convert written out numbers (e.g. "duizendnegenhonderddrieënzeventig") into digits (1973) using a fast Rust + Python binding.

Based on: https://github.com/allo-media/text2num-rs

Works for the following languages:

  • Dutch ("nl")
  • English ("en")
  • French ("fr")
  • Spanish ("es")
  • German ("de")
  • Italian ("it)

Installation

pip install polytext2num

Usage

from polytext2num import text_to_number, replace_all_numbers

print(text_to_number("duizendnegenhonderddrieënzeventig", "dutch"))    # → "1973"
print(text_to_number("one thousand nine hundred seventy-three", "en")) # → "1973"
print(text_to_number("quatre-vingt-dix", "french"))                    # → "90"


replace_all_numbers("I have two apples and one banana", "english", threshold=10.0)
# → "I have 2 apples and 1 banana"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

polytext2num-0.2.20-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (347.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

polytext2num-0.2.20-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (348.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

polytext2num-0.2.20-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (348.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

polytext2num-0.2.20-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (348.6 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

polytext2num-0.2.20-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (348.3 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

polytext2num-0.2.20-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (348.1 kB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

File details

Details for the file polytext2num-0.2.20-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for polytext2num-0.2.20-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d26c33eaf9e0b7214d95411100990b738e338a78124ab73348b24228e8762034
MD5 75a6290212c9e7511d533be117d5824c
BLAKE2b-256 311672b6ba3fdb57ea30115b1eb3a9ac6274b8469fda1cb83f5d5a379ab379f5

See more details on using hashes here.

File details

Details for the file polytext2num-0.2.20-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for polytext2num-0.2.20-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e43fbf473cd2244378062df23b296c800e2a4477766a72221c6b58312a590761
MD5 5d54ffc89372570817e066b7341b4081
BLAKE2b-256 459ffa251d4095694921df39481835ef7dcca92ca73cfeb6a71dbf2ffa4fc41d

See more details on using hashes here.

File details

Details for the file polytext2num-0.2.20-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for polytext2num-0.2.20-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8897442b8d523d60f18be68f0bb824e9487ace355c817156d4ad35fc7f161d2c
MD5 029964939d9018e6ecab8a9a873e0cfb
BLAKE2b-256 24de92941eb45807c2d359e46328ef53f62bf4119b6acba320b8abb89473708b

See more details on using hashes here.

File details

Details for the file polytext2num-0.2.20-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for polytext2num-0.2.20-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 51bce5f53950cecc3a6153e6689343a0a0bfd4ef2772b353cbb11c373f5a2d9d
MD5 b5163f2aaebe3bad89e0317fb7874988
BLAKE2b-256 1635d0c44cc87100edbf6e6d2b40e6b0c932cece4847cef321f6a953958f0d32

See more details on using hashes here.

File details

Details for the file polytext2num-0.2.20-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for polytext2num-0.2.20-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 de0f2fd80adc02ab36ba069cc334f1b094edda62bccf5c9cb8611a497aa8c9b4
MD5 9b78c889a9afb1e0475465454b337953
BLAKE2b-256 2995b1e649e1574feb1343ec12152bb0bc915760b1b94667666249fa621de96e

See more details on using hashes here.

File details

Details for the file polytext2num-0.2.20-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for polytext2num-0.2.20-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c6faef2a954d4c73042a26efa160d420120af82727f5d9885ef280fcf76b2fb7
MD5 445fc7c9341b1e59e70ad2ba3a69f36c
BLAKE2b-256 18d323fe48b3501b18d787dc15440c54ff1c58c8ad19142d3dcc96587e093f76

See more details on using hashes here.

Supported by

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