Skip to main content

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

Project description

polytext2num

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 txt2num, word2num

print(word2num("negenhonderdvijfenzestig", language="dutch"))
# → "965"

print(word2num("two hundred and thirty four", language="english"))
# → "234"

print(txt2num("duizendnegenhonderddrieënzeventig", "dutch"))    
# "1973"

print(txt2num("one thousand nine hundred seventy-three", "en")) 
# "1973"

print(txt2num("quatre-vingt-dix", "french")) 
# "90"

print(txt2num("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.3.1-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.3.1-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.3.1-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.3.1-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.3.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (348.2 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

polytext2num-0.3.1-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.3.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for polytext2num-0.3.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a7cc8183faa286520eb70598e0c3813a2eeb5eed701be410e66f32cd447bea71
MD5 5383972add392dcb844a576060682ae6
BLAKE2b-256 10f00cc69d9248328d940c6f53c1aaa8fea282e464936df61e67c88ec48a5136

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polytext2num-0.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bb527c804843fcb97f94e08295cd8b92dd73d763eedb20e5cf9349a0e4499b70
MD5 e85da446e478868891d90c1f695ad869
BLAKE2b-256 51a971ee7c403d8a735188d40a023ba2f85c5fa0d3883fbc1e1fdff79a15a82c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polytext2num-0.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b36e66ba86d18d875d71201cbb3352f298177747a5288dedc5c3a4a32b12bfe8
MD5 bda4644215b464c8ee3137c67d185620
BLAKE2b-256 dd9af6a3c72ef53e7ae1ae5e86f0ff74e0aca52b952eb50696efe67aa6fc415b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polytext2num-0.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 be6279e5c8e64c24c87fcf1626f6e0126e0ae877360e07409a79430c6965e5fc
MD5 b37674871f0ea86ab2ef67fde802f428
BLAKE2b-256 d7bbf56977143dd0183306b0d393c71fb3aed0289342519e650e274f1609ecae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polytext2num-0.3.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9ea121cd20987e65597e03d672825861cd90a5ed65d775ada68644169f72046d
MD5 1d3debe6b35ce9890bf2a5c49c2f7b3c
BLAKE2b-256 f48afa639f398ec3b4bd4864734cb060bdb5333084cd71e1a92867d5198b296d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polytext2num-0.3.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8aeef551226de5175e704761806bfe0b1429e5d5789c3fb5c7abfccaba703ad1
MD5 b22a59e0384c5d31eeb927842bcec41c
BLAKE2b-256 637380fab3b2bbaeab332a6237fbb422dcc29399e20cdcb551e66fa2670551f4

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