Skip to main content

Simple class for replace test with regex. Support scikit-learn transformer interface.

Project description

Regex Replacer

This is simple package for fast replace texts with regex. Support Rust regex syntax: https://docs.rs/regex/latest/regex/#syntax

Installation

pip install regex_replace --upgrade

Usage

from regex_replacer import RegexReplacerTransformer

transformer = RegexReplacerTransformer([
    (r'[0-9]+', " NUMBER "),
    (r"[a-z]+", " WORD ")
])
test_strings = [
    "this is a SIMPLE TEXT 12345 with number"
]
print(transformer.transform(test_strings))

# Output: [' WORD   WORD   WORD  SIMPLE TEXT  NUMBER   WORD   WORD ']

for multithread transform:

transformer = RegexReplacerTransformer([
        (r'[0-9]+', " NUMBER "),
        (r"[a-z]+", " WORD ")
    ], n_jobs=3)

to back to single thread:

transformer.to_single_thread()

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

regex_replacer-0.1.2-cp313-cp313t-manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.13t manylinux: glibc 2.28+ x86-64

regex_replacer-0.1.2-cp313-cp313-manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.13 manylinux: glibc 2.28+ x86-64

regex_replacer-0.1.2-cp312-cp312-manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.28+ x86-64

regex_replacer-0.1.2-cp311-cp311-manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ x86-64

regex_replacer-0.1.2-cp310-cp310-manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

regex_replacer-0.1.2-cp39-cp39-manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

File details

Details for the file regex_replacer-0.1.2-cp313-cp313t-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for regex_replacer-0.1.2-cp313-cp313t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cf293739f273652815082cf2bb639065b37c5dc102e760bb6f800ae086d65bf0
MD5 1e6fc34702efff13342d446d34e61d45
BLAKE2b-256 3eef9773b013d2a729e38daf57903abf8daa96997e2c682e8addea997e398707

See more details on using hashes here.

File details

Details for the file regex_replacer-0.1.2-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for regex_replacer-0.1.2-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 953a6e8501eb43804c568291ee1f7e9542fb4f30d4f34f4b85233585b87bc2ae
MD5 ccdb724e2449a4871df656fd8fd909e5
BLAKE2b-256 66035f963be9c033db1862f9fa6469365820354123156fc190481c6f3bb8477d

See more details on using hashes here.

File details

Details for the file regex_replacer-0.1.2-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for regex_replacer-0.1.2-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 49137e36fc66530873083aa8f7d5accafee489287332f44e77458b543a0cc785
MD5 559dcb4bb517345a3819612f19ccd1f0
BLAKE2b-256 30e2b299e9a0a83502a58109fed30ded77fca9d98a5c9f8ecfe3af17e3e2d2d1

See more details on using hashes here.

File details

Details for the file regex_replacer-0.1.2-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for regex_replacer-0.1.2-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e29920e1a25f4517744f1230312a4f47778318e9b77ab891d6b3ceec62e4b072
MD5 e81842f5937925b902de8587d3c665ec
BLAKE2b-256 9ea576a07e722cdea2c4f951b1afa7a8229066037f499ba7ef14d8a4d6958824

See more details on using hashes here.

File details

Details for the file regex_replacer-0.1.2-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for regex_replacer-0.1.2-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4b7996d7768e0a8871704db21ede4c1d98e9a2a4f7f932700e122c147e2c572c
MD5 f7a2626e2f405681d18b48321e34950b
BLAKE2b-256 44a061dd2248d868d95e8fc52ee3945f733731c43c92a74478d161b74fe5128d

See more details on using hashes here.

File details

Details for the file regex_replacer-0.1.2-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for regex_replacer-0.1.2-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f13ea76fa6d8ef75c4f09d2d89386676ef80581f2a53a044a9da527f74321533
MD5 9852ad3eeb7e0cd1da042209ec4d241b
BLAKE2b-256 dd7512edc3f37486bd4d29952100d7f3e4080d78511748f3347e48e0a044c163

See more details on using hashes here.

Supported by

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