pybmoore
Python/Cython implementation of Boyer-Moore string-search algorithm.
Installing
Install and update using uv:
uv pip install pybmoore
notice:
gccmust be available on the system.
Usage
Single term
The search method in the pybmoore module will return a list of tuples with all occurrences, where the tuple have the initial and final position. For example:
import pybmoore
TEXT = """The Boyer–Moore string-search algorithm is
an efficient string-searching algorithm that is the
standard benchmark for practical string-search literature.
"""
matches = pybmoore.search('string', TEXT)
print(f"Occurrences: {len(matches)}")
# output: Occurrences: 3
print(matches)
# output: [(16, 22), (57, 63), (130, 136)]
for x, y in matches:
print(f"({x},{y}) - {TEXT[x:y]}")
notice: search method it's case sensitive.
import pybmoore
TEXT = """The algorithm preprocesses the string being searched for (the pattern),
but not the string being searched in (the text). It is thus well-suited for
applications in which the pattern is much shorter than the text or where it
persists across multiple searches.
"""
pybmoore.search('algorithm', TEXT)
# output: [(4, 13)]
pybmoore.search('Algorithm', TEXT)
# output: []
Multiple terms
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
import pybmoore
TEXT = """The Boyer-Moore algorithm searches for occurrences of P in T by
performing explicit character comparisons at different alignments. Instead of a
brute-force search of all alignments (of which there are m − n + 1, Boyer-Moore
uses information gained by preprocessing P to skip as many alignments as possible.
"""
# Using a list of patterns
pybmoore.search_m(['brute-force', 'Boyer-Moore'], TEXT, ProcessPoolExecutor)
# output: {'brute-force': [(146, 157)], 'Boyer-Moore': [(4, 15), (214, 225)]}
# Using a set of patterns
pybmoore.search_m({'brute-force', 'Boyer-Moore'}, TEXT, ThreadPoolExecutor)
# output: {'brute-force': [(146, 157)], 'Boyer-Moore': [(4, 15), (214, 225)]}
# Using a tuple of patterns
pybmoore.search_m(('brute-force', 'Boyer-Moore'), TEXT, ThreadPoolExecutor, max_workers=4)
# output: {'brute-force': [(146, 157)], 'Boyer-Moore': [(4, 15), (214, 225)]}
Details
For granular control of the pool, use the parameters listed in the module documentation. For example:
Development
To build pybmoore locally first install requirements-dev.txt dependencies and run:
make build # without Cython
make build USE_CYTHON=1 # with Cython
in some cases it's necesary run
make cleanbeforemake build.
Type make in the command line to see all available targets.
Links
- License: Apache License
- Code: https://github.com/amenezes/pybmoore
- Issue tracker: https://github.com/amenezes/pybmoore/issues
Release files for pybmoore 2.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size:3.6 MB
Release files / pybmoore-2.2.0-cp314-cp314-musllinux_1_2_x86_64.whl
| Download URL | pybmoore-2.2.0-cp314-cp314-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 184.9 kB |
| Tags | CPython 3.14 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
f5a890bd5a2a147e973b8eaaffa68269994ea918bb6c814abbf98d6363788f2c
|
|
BLAKE2b-256 checksum How to use checksums |
87ba7468d5220127c10a8a5cbaebefcc879a1261aafef90f76841e379309d6f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.15
|
Release files / pybmoore-2.2.0-cp314-cp314-musllinux_1_2_aarch64.whl
| Download URL | pybmoore-2.2.0-cp314-cp314-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 181.9 kB |
| Tags | CPython 3.14 Linux musl 1.2+ ARM64 |
|
SHA-256 checksum How to use checksums |
db2e95cfae58375da64cac5a32107c14f2895d55c327ca9ae7a3f7ce701052a0
|
|
BLAKE2b-256 checksum How to use checksums |
34179b8309de1e8bc043870bef507daeb4676a1e4c371ee2886356598d060c89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.15
|
Release files / pybmoore-2.2.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
| Download URL | pybmoore-2.2.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 183.2 kB |
| Tags | CPython 3.14 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
56a8b43d8cb4ad9c8a29c500add6c9d7cb0067d10fcfed389547e545c83d4966
|
|
BLAKE2b-256 checksum How to use checksums |
7f5cb97d06d8f876193c90be241be6748dd9dfab4faa3c0a773e6668d6fff596
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.15
|
Release files / pybmoore-2.2.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | pybmoore-2.2.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 184.9 kB |
| Tags | CPython 3.14 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
aa7b109c67fe23bd2625af5e828070fb1a750390f1873c6ada1d9b58bb55ffd5
|
|
BLAKE2b-256 checksum How to use checksums |
9ef8d35400ca19d1fe55c1032d02ba972bd469e28ae47bd49065f51e1d5e89ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.15
|
Release files / pybmoore-2.2.0-cp313-cp313-musllinux_1_2_x86_64.whl
| Download URL | pybmoore-2.2.0-cp313-cp313-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 186.3 kB |
| Tags | CPython 3.13 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
8a7cdec6548845c767ed2df2d3cc14156a5ac8461220a9a730ec1239ee7c9901
|
|
BLAKE2b-256 checksum How to use checksums |
f1dffa9482e86e6b78b613687db7722d28f1879c7418e7a6a1d8eda8401e973b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.15
|
Release files / pybmoore-2.2.0-cp313-cp313-musllinux_1_2_aarch64.whl
| Download URL | pybmoore-2.2.0-cp313-cp313-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 181.9 kB |
| Tags | CPython 3.13 Linux musl 1.2+ ARM64 |
|
SHA-256 checksum How to use checksums |
55ecaa9ea47cbcb11bf83c1b7491e5363c32e1d79360cc3b15e2fe2d94d8df66
|
|
BLAKE2b-256 checksum How to use checksums |
f65b003216f105300117c2185333f07adecad0947173b76af23c184b47b75c14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.15
|
Release files / pybmoore-2.2.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
| Download URL | pybmoore-2.2.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 182.9 kB |
| Tags | CPython 3.13 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
f8ec43fe16104cdd767ceda02e4baf71b3bd62a89d52b7d316446362718a0a14
|
|
BLAKE2b-256 checksum How to use checksums |
06ee2c0722bf917125d668e8133134a9f610b22fdf5c69d91644a6b41f5ba5e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.15
|
Release files / pybmoore-2.2.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | pybmoore-2.2.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 185.4 kB |
| Tags | CPython 3.13 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
97ca98ff407d8052835e54a1ea2fd86e80a8b540cf7895d8862fe1bb2e5d3088
|
|
BLAKE2b-256 checksum How to use checksums |
ea4d6ceff7396eb2bbd368ab63f1a2d0cbb12288658743aec5f4e83c8e86eb62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.15
|
Release files / pybmoore-2.2.0-cp312-cp312-musllinux_1_2_x86_64.whl
| Download URL | pybmoore-2.2.0-cp312-cp312-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 189.2 kB |
| Tags | CPython 3.12 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
d3c3c061e6640a85f06bb3dcc683e10e65ca69f75029f13ab6abf91593b7ad3f
|
|
BLAKE2b-256 checksum How to use checksums |
a415b02f3c1110c62e9435821ca736fae55cef14cdba0451cfe83f5670379f79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.15
|
Release files / pybmoore-2.2.0-cp312-cp312-musllinux_1_2_aarch64.whl
| Download URL | pybmoore-2.2.0-cp312-cp312-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 184.9 kB |
| Tags | CPython 3.12 Linux musl 1.2+ ARM64 |
|
SHA-256 checksum How to use checksums |
b31f64fff57c0d414d09655eb2f52fdccf8cce9a5105159c634d842fac6bf22d
|
|
BLAKE2b-256 checksum How to use checksums |
a9e32bb90a205ed1da60359229ee79b86895080c2212adacf0000d735e4fee62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.15
|
Release files / pybmoore-2.2.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
| Download URL | pybmoore-2.2.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 186.6 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
266a90509d4fda23dd395bbb4bd46b60ee1e3513aafbf18752a72d40cc9a7f84
|
|
BLAKE2b-256 checksum How to use checksums |
d4c18dfe34ef20f65c516904fa300c66fba1ef33ead7bd374ff3099b66cc7d83
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.15
|
Release files / pybmoore-2.2.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | pybmoore-2.2.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 188.6 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
e8f1b0a0ed605c144e7e6388a54d785c68bd6856a44da93f52ab707a7afae7bb
|
|
BLAKE2b-256 checksum How to use checksums |
cc7da5e9d4765e92d3fbc5a07464aa762a48d9ad319ee59a178d0782c90b2bed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.15
|
Release files / pybmoore-2.2.0-cp311-cp311-musllinux_1_2_x86_64.whl
| Download URL | pybmoore-2.2.0-cp311-cp311-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 184.8 kB |
| Tags | CPython 3.11 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
d0fe5074c35979fb5b850dee27a07a9031d5794ff60aac8f94cec973c43022ef
|
|
BLAKE2b-256 checksum How to use checksums |
58b38912fbc9e5856f2ef8e29464b8aa54076abec46686627e9194fdf3927e30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.15
|
Release files / pybmoore-2.2.0-cp311-cp311-musllinux_1_2_aarch64.whl
| Download URL | pybmoore-2.2.0-cp311-cp311-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 179.0 kB |
| Tags | CPython 3.11 Linux musl 1.2+ ARM64 |
|
SHA-256 checksum How to use checksums |
e2ca738ac35b09f1febb03c7e8074f11fa75d279e054830c5ff18b7ac0f37eaa
|
|
BLAKE2b-256 checksum How to use checksums |
f3a155ccec05ca767ef6fac14fa90b0998eae257c21a63453ae5a774e798b371
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.15
|
Release files / pybmoore-2.2.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
| Download URL | pybmoore-2.2.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 180.6 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
1fbcdd6763bad718925f153e6008656a11f35dd3ce6feced498eca0586c56257
|
|
BLAKE2b-256 checksum How to use checksums |
b742eaad102b9703a0cb1d913cfd6fd8ab66ed6c0d7498f8f89032a087035607
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.15
|
Release files / pybmoore-2.2.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | pybmoore-2.2.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 183.2 kB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
4c42132ca3b448c6a3db9102bc8069f19b30fb0e20aae42d97dc439c9bf89eea
|
|
BLAKE2b-256 checksum How to use checksums |
f13592030e866850ffbe3ebcf451ed0870dff3bfd5d0c9c8693f5f76811d49a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.15
|
Release files / pybmoore-2.2.0-cp310-cp310-musllinux_1_2_x86_64.whl
| Download URL | pybmoore-2.2.0-cp310-cp310-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 170.2 kB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
853d87c51b3b175c09d3f9a4d6e8629ac7de161330fd79125337cc5f1ecb8f5d
|
|
BLAKE2b-256 checksum How to use checksums |
81840f097da0bce286f5fab525b260de142f434d487b2c780854d411be81ade3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.15
|
Release files / pybmoore-2.2.0-cp310-cp310-musllinux_1_2_aarch64.whl
| Download URL | pybmoore-2.2.0-cp310-cp310-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 167.6 kB |
| Tags | CPython 3.10 Linux musl 1.2+ ARM64 |
|
SHA-256 checksum How to use checksums |
f893ae6c59c43da0154d2c89ca090dbac86abee821dae79f09b5b77ca3224fb1
|
|
BLAKE2b-256 checksum How to use checksums |
9e9f20ee1a568e7aa8e6f867b7f6ed55bd3629c65910f1f9b04905f91dd8cee5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.15
|
Release files / pybmoore-2.2.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
| Download URL | pybmoore-2.2.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 168.6 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
75bc409a978ab38547b7a4c572cf1a835a8502f2e2b795361da7b2dcff027a54
|
|
BLAKE2b-256 checksum How to use checksums |
294e9478c32bba7c08f30dd55e0719bc529be719b6a0e659ae05f8b559523c2b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.15
|
Release files / pybmoore-2.2.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | pybmoore-2.2.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 171.6 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
54b94fede963dbd424455a02a018687952e60ccbf47a5e6ea5035f6122507998
|
|
BLAKE2b-256 checksum How to use checksums |
ab44b543eb4692d7593040262edf751b417df72ff2d2f4446c8ff1733d43786b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.15
|