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, twenty kegs.", "en", threshold = 10)
# → "I have two apples and one banana, 20 kegs."

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.21-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.21-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (348.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

polytext2num-0.2.21-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.21-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.21-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.21-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (348.2 kB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

File details

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

File metadata

File hashes

Hashes for polytext2num-0.2.21-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 32c47f12a2ea29132141503c2fbb012adc70ea0ce16a0a23fab0b9ed0806cb52
MD5 e007e274c451f383045b289b3043a29c
BLAKE2b-256 71aa2e8069397dbf49eeebc236fa350046d5ba7e17e81ca81b3546e208a40b12

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polytext2num-0.2.21-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f3040a0fdad07a1b653846c9dd5706007ee7551e705d735f2d1e65a9ad0c9bb7
MD5 fc8e1e2d27ef0239d6f0d1ae61bab49e
BLAKE2b-256 942db88f3c3153e4cf8471891e66cbe03e29f0263f1df6792b968aa93b79be9c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polytext2num-0.2.21-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 32dc9a498a4cf69a740b9d12a2ff70a146e4ebe7db2d2a79097a9bfbe8504bb2
MD5 04b1e131f43e057b7976a20f1f95fab8
BLAKE2b-256 469f634792e26f4dc7f87b9b52c1fe4e49b205426ebf49fa7f91ddfa6efd6173

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polytext2num-0.2.21-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bb078961ef85283fce1654a28ccfeba5ccf68f28c62110f008d4e768cc43f38c
MD5 d12710dbc40216df01ac927ebc21111d
BLAKE2b-256 60b443078b6f9370e73bd4707bd239f842b07b939f993f010825fbf7b516409a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polytext2num-0.2.21-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 32fd623784a5fa931e5a83f74fe1f57ad639d15d0bb6827077294b207b534a2c
MD5 3f742b3c0b838b865902e342d6f2b7d9
BLAKE2b-256 a0f207730269c555371f7599135a9ba1a2bcfe5060fbeea0a0564535d8e5c639

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polytext2num-0.2.21-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bae1d1b41069bdbd3d45ebe87839b984dac63f581a6567772c03051c4bd834cb
MD5 0320c9d5d9ddf65647eec0cb5ec9d6a9
BLAKE2b-256 b2e72f2a835480fb98c0d15c9fd7f035f26e686fb429afe38f7a199875ce0db1

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